Colour names to HEX conversion #633

Open
opened 2026-02-04 20:37:34 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @madduck on GitHub (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

Originally created by @madduck on GitHub (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
OVERLORD added the enhancement label 2026-02-04 20:37:34 +03:00
Author
Owner

@hwelch-fle commented on GitHub (Jan 20, 2025):

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.

@hwelch-fle commented on GitHub (Jan 20, 2025): Since you're using `plankapy`, here's some literals from the `v2` re-write you can use for now: ```python 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.
Author
Owner

@madduck commented on GitHub (Jan 21, 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.

@madduck commented on GitHub (Jan 21, 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.
Author
Owner

@hwelch-fle commented on GitHub (Jan 21, 2025):

@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.

@hwelch-fle commented on GitHub (Jan 21, 2025): @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.
Author
Owner

@madduck commented on GitHub (Jan 21, 2025):

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

@madduck commented on GitHub (Jan 21, 2025): @hwelch-fle they are only defined in the SCSS files...
Author
Owner

@hwelch-fle commented on GitHub (Jan 21, 2025):

@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.

@hwelch-fle commented on GitHub (Jan 21, 2025): > [@hwelch-fle](https://github.com/hwelch-fle) they are only defined in the SCSS files... [Heres the commit](https://github.com/hwelch-fle/plankapy/commit/592ac473e65e3689b9eb4752b5e918bc82484770) with the mappings added. Labels are just hexcodes while the Gradients are strings of CSS code for generating the gradient.
Author
Owner

@madduck commented on GitHub (Jan 21, 2025):

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

@madduck commented on GitHub (Jan 21, 2025): Very cool, thank you. When Planka exposes this in an API, then you can hopefully drop this hard-coded weight.
Author
Owner

@hwelch-fle commented on GitHub (Jan 21, 2025):

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).

@hwelch-fle commented on GitHub (Jan 21, 2025): > 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).
Author
Owner

@madduck commented on GitHub (Jan 21, 2025):

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

@madduck commented on GitHub (Jan 21, 2025): @hwelch-fle are you on IRC or Matrix where we can discuss? I wrote some thoughts into https://github.com/hwelch-fle/plankapy/pull/9 but Github PRs and issues aren't really the right forum to get started.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#633