terriko / pyknit

A set of tools for knitters to create charts and eventually more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Colour charts

terriko opened this issue · comments

Currently the charting software expects a symbol (see #10) , but for colourwork knitting we'd probably want to accept a colour value in the legend and have it fill the square with that colour.

Here's an example of a fairly typical colourwork motif as part of a pattern:

https://www.dummies.com/crafts/knitting/knitting-projects/how-to-knit-a-headband-with-a-fair-isle-snowflake-pattern/

two-colour patterns are often represented as dark grey and white for various reasons (good contrast for most types of vision, less distraction if you're knitting in an alternate colour, cheaper to print) but we'd likely want to accept any arbitrary colour so folks doing interactive patterns could change the legend to suit their preferences in the moment.

Since we're using Pillow for charts, we could pretty much use any way to specify colour that it understands:

https://pillow.readthedocs.io/en/stable/reference/ImageColor.html

I'm guessing the hexidecimal represented as #rrggbbaa (or the shorter forms) might be the easiest to use with since it's pretty well known and easy for folk to cut/paste from some sort of colour picker.

commented

Hey, I found this project off the video of your presentation at PyCon last year, and I'm new to open source, but keen to get involved. I've tinkered a bit with the charting module, and got something that might be useful.

For the color picking, the ipywidgets module provides a ColorPicker that can be used within the notebook:

image

And I've extended the charting to do a 2D chart, using the triangle hat example from the docs:
triangle_hat

I'm not sure how to test the charting functions I've written, and not sure how the PR process works. Do I get everything back into my main branch before raising a PR?

Still need to figure out the parsing on the 2D charts for splitting rows/ ignoring repeats for the chart. (I've also added a bit to work for Issue #30, using pngs for the symbols.) The logic for either of these could easily be ported to svg, which might make styling the chart as a whole easier, as well as allowing better scaling

This looks amazing. I'd love to see it integrated!

The PR process usually goes like this:

  1. You make a branch with all the changes you want merged
  2. You push that branch to your fork on github
  3. You open a pull request with that branch https://github.com/terriko/pyknit/pulls (if you've recently pushed to a branch in your fork it should prompt you or you can use the "new pull request" button)
  4. Tests run (such as they are) and I review it. If you need to make any changes, you can make them in that branch.
  5. I merge the code! Usually I squash all commits so you don't have to worry about doing that unless you want to.

You don't have to have a separate branch if you want to do a pull request using your fork's main branch, but I find it a lot easier to have each pull request in a separate branch so you can have lots of pull requests going at the same time if you want and so I can keep my main branch in sync with upstream/origin.