Skip to content

Generated palette sort order #27

@eliduke

Description

@eliduke

I just came across this gem in an attempt to autogenerate some colors for chart.js. It's very cool and working quite well so far. Thank you for all the hard work!

The only problem I'm having is the sort order for a generated palette, specifically the first / last color in the array. It's possible that I'm missing some config option or something, but, lemme break it down for you

I'm using this code to create my monochromatic palette:

"#ff6384".paint.palette.monochromatic(size: 16, as: :hex)

Which is generating this array (I've truncated it for brevity):

["#ff6384", "#100608", "#200c11", "#301319", "#401921", "#501f29", "#602532" ... ]

Which produces this color palette in my chart:

screen shot 2018-01-25 at 1 23 41 pm

As you can see, it looks like the first color needs to go to the end or the rest of the array (except for the first one) needs to be reversed.

I even checked your examples in the README, and I'm seeing the same problem:

'red'.paint.palette.monochromatic(as: :hex)
#=> ['#ff0000', '#2a0000', '#550000', '#800000', '#aa0000', '#d40000']

That goes from red to (basically) black and then works its way back toward red.

Is there a way to specify "direction" in a palette? Like, to be able to pass in an argument to the palette to start with my seed color or end with my seed color.

Thoughts on this? Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions