Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colour charts #21

Closed
terriko opened this issue May 17, 2021 · 3 comments
Closed

Colour charts #21

terriko opened this issue May 17, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@terriko
Copy link
Owner

terriko commented May 17, 2021

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.

@terriko terriko added the enhancement New feature or request label May 17, 2021
@terriko
Copy link
Owner Author

terriko commented May 17, 2021

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.

@sorla
Copy link
Contributor

sorla commented Apr 23, 2022

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

@terriko
Copy link
Owner Author

terriko commented Apr 27, 2022

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.

@sorla sorla mentioned this issue Apr 29, 2022
@terriko terriko closed this as completed May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants