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 names to HEX conversion #999

Open
madduck opened this issue Jan 20, 2025 · 8 comments
Open

Colour names to HEX conversion #999

madduck opened this issue Jan 20, 2025 · 8 comments
Labels
enhancement New feature or request

Comments

@madduck
Copy link

madduck commented Jan 20, 2025

Hello,

Colours like berry-red, as used by Planka, are not standard. I am trying to do some work via the API, and it would be really good to have an endpoint where I can obtain the list of colours and their HEX representations.

It seems that the code might also benefit from this, as currently, the list of colour names and their CSS HEX codes are defined in separate places.

Thank you,
Martin

@meltyshev meltyshev added the enhancement New feature or request label Jan 20, 2025
@hwelch-fle
Copy link

Since you're using plankapy, here's some literals from the v2 re-write you can use for now:

LabelColor = Literal[
  'berry-red',
  'pumpkin-orange',
  'lagoon-blue',
  'pink-tulip',
  'light-mud',
  'orange-peel',
  'bright-moss',
  'antique-blue',
  'dark-granite',
  'lagune-blue',
  'sunny-grass',
  'morning-sky',
  'light-orange',
  'midnight-blue',
  'tank-green',
  'gun-metal',
  'wet-moss',
  'red-burgundy',
  'light-concrete',
  'apricot-red',
  'desert-sand',
  'navy-blue',
  'egg-yellow',
  'coral-green',
  'light-cocoa',
]

Gradient = Literal[
  'old-lime',
  'ocean-dive',
  'tzepesch-style',
  'jungle-mesh',
  'strawberry-dust',
  'purple-rose',
  'sun-scream',
  'warm-rust',
  'sky-change',
  'green-eyes',
  'blue-xchange',
  'blood-orange',
  'sour-peel',
  'green-ninja',
  'algae-green',
  'coral-reef',
  'steel-grey',
  'heat-waves',
  'velvet-lounge',
  'purple-rain',
  'blue-steel',
  'blueish-curve',
  'prism-light',
  'green-mist',
  'red-curtain',
]

I agree that these color names are a bit silly and they should be using a standard CSS color library or raw HEX codes. maintaining these color lists is a manual process for now unless an endpoint is created to pull registered colors and gradients.

@madduck
Copy link
Author

madduck commented Jan 20, 2025

I saw your lists @hwelch-fle, but they don't have the hex colours. So if I implement my own UI, I have to hard-code the colours there.

@hwelch-fle
Copy link

@madduck I can't even seem to find the HEX codes in the planka repo, If you share them, I'll add them to the plankapy project for easy conversion.

@madduck
Copy link
Author

madduck commented Jan 20, 2025

@hwelch-fle they are only defined in the SCSS files...

@hwelch-fle
Copy link

@hwelch-fle they are only defined in the SCSS files...

Heres the commit with the mappings added. Labels are just hexcodes while the Gradients are strings of CSS code for generating the gradient.

@madduck
Copy link
Author

madduck commented Jan 21, 2025

Very cool, thank you. When Planka exposes this in an API, then you can hopefully drop this hard-coded weight.

@hwelch-fle
Copy link

Very cool, thank you. When Planka exposes this in an API, then you can hopefully drop this hard-coded weight.

Definitely check out v2 if you get the chance, I definitely need some feedback on it. Been testing async and it seems to work for the most part, but you have to write your async functions yourself as each interface is just a container for route generators. Got some quick and dirty examples in the tests module.

Next order of business is to build tests and docs now that it works (and a lot faster than v1 in my testing, was able to make 100 cards in about 1 second using an async for loop).

@madduck
Copy link
Author

madduck commented Jan 21, 2025

@hwelch-fle are you on IRC or Matrix where we can discuss? I wrote some thoughts into hwelch-fle/plankapy#9 but Github PRs and issues aren't really the right forum to get started.

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

3 participants