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

Colors #81

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Colors #81

wants to merge 13 commits into from

Conversation

nicolaje
Copy link
Member

Adds long awaited:

  • line styling and sizing : by properties : .."LineStyle",":","LineWidth",4.2... or by format "darkRed-..[blue]"
  • all colors naming from http://www.w3.org/TR/SVG/types.html#ColorKeywords
  • custom RGB/RGBA color setting : by properties : .."FaceColor",(vibes::RGBA){100,100,1,255}... or by format : "mediumslateblue-..[255,42,35,12]"

Are you OK with this format?

How would you like to specify a lineWidth in the format?
for example, to set a 12 width line with : style, blue edges, white face, possibilities are:

  • "@12@:blue[white]"
  • "{12}:blue[white]
  • ?? suggestions

Should we add a way to specify transparency for named colors in the format?

@dvinc @SimonRohou @ThomasLeMezo @msis @ClementAubry

@nicolaje
Copy link
Member Author

@benEnsta could you check why your proposition for coloration using #RGB isn't integrated?

@benEnsta
Copy link
Contributor

I checked my code, with your proposition coloration using #RGB or #RRGGBB works without any problem.

However I wonder why the new brush (or pen) aren't saved in the _brush QHash list because it avoid to instantiate a new brush for each item.
I created a pull request with my old code which handles colors and transparency, may be some idea can be taken.

@nicolaje
Copy link
Member Author

Agreed, I just didn't want to copy/paste the 149 color names, but I will.

@benEnsta
Copy link
Contributor

I think you don't have to copy color names. Just instead of directly return the new color object, you should add it to _brush. You should also check if the color exist in _bruch before. So if the color already exist in the QHash return the brush else add the new color.

@benEnsta benEnsta closed this Oct 17, 2015
@benEnsta benEnsta reopened this Oct 17, 2015
@nicolaje
Copy link
Member Author

I see what you mean, I will do it this way.

@nicolaje
Copy link
Member Author

Done. If nobody disagrees with the RGBA color settings command, I will merge this pull request by the end of the week.

@nicolaje
Copy link
Member Author

I actually don't like passing RGB/A colors in the "format" field.
To keep it "Matlab simple", it is preferable to be able to specify the line width in the format, which would be cumbersome to parse if RGB/A colors are allowed too.
So:

  • keep the aditional 100+ named colors in the format field
  • specify line width in the outside color field, ie: "pink:-5[red]" to have a pink dot-dot-dash 5 wide line with blue interior, "magenta-[purple]5" to have a magenta full 5 wide line, "18yellow--[cyan]" etc...
  • RGB/A are set in the "EdgeColor" and "FaceColor" fields

@dvinc
Copy link
Contributor

dvinc commented Oct 29, 2015

I am not sure having lineWidth setting in the format field keeps things "Matlab simple" (Matlab uses a separate lineWidth property) but why not if you clearly see an advantage. Basically, I think the format field has to remain simple and readable, so don't make it too complicated. People wanting to do more advanced things (like RGBA color selection) are advanced users, so they have to learn how to specify additional properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants