question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some of the wrapped graphics APIs have concept of named colors (eg. NSColor on macOS). These could be system colors (eg. window background, border color) or custom catalog colors. Converting them to the internal Color type however loses their lazy resolution to actual RGB value (eg. the named color can have different color based on system wide dark mode / light mode). Is there any plan to expose this functionality? Even System.Drawing had it in some limited form.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
charlesroddiecommented, Apr 3, 2021

Even System.Drawing had it in some limited form.

This is a huge wart in System.Drawing.Color that needs correction. Adding something like names to the Color type causes ineffiency and complex interdependencies.

Maui (not Maui.Graphics) could have functions like getBorderColor:unit -> Color etc. or even tryGetColorFromOSNamedColor(name:string):Color?. That would allow users to get these colors without adding complexity to the Color type.

1reaction
filipnavaracommented, Apr 3, 2021

@charlesroddie I think there’s quite a distinction between color manipulation type and abstract color description type. System.Drawing.Color tried to do both at the same time and lacked a bit on both. I didn’t ask for specific API shape or even having one type for both.

Just like R,G,B is only describing a color when interpreted in a specific color space (eg. sRGB, Adobe RGB), named colors are also meaningful only within their respective color space (eg. dark theme, light theme).

This library specifically states the goal of abstraction over native graphics libraries for drawing. CoreGraphics has concept of named colors (extensible), Windows has concept of named colors (albeit limited).

Read more comments on GitHub >

github_iconTop Results From Across the Web

<named-color> - CSS: Cascading Style Sheets | MDN
The <named-color> CSS data type is the name of a color, such as red , blue , black , or lightseagreen . Syntactically,...
Read more >
Color Names
Modern browsers support 140 named colors, which are listed below. Use them in your HTML and CSS by name, Hex color code or...
Read more >
Named Colors
Color Name Hex RGB Absolute Zero 0048BA 0, 72, 186 Acid green B0BF1A 176, 191, 26 Aero 7CB9E8 124, 185, 232
Read more >
List of colors: A–F
Name Hex (RGB) Red (RGB) Green (RGB) Blue (RGB) Hue (HSL/HSV) Satur. (H... Absolute Zero #0048BA 0% 28% 73% 217° 100% Acid green #B0BF1A 69%...
Read more >
List of named colors
This plots a list of the named colors supported in matplotlib. For more information on colors in matplotlib see. the Specifying colors tutorial;....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found