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

[Core] Make color type configurable (#75) #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matevzmihalic
Copy link

Allow users to define Clay_Color type which would allow us to use the same type in clay and in renderer which would omit the currently needed conversions.
I've also added CLAY_COLOR_RGB and CLAY_COLOR_RGBA that should be used instead of hard coded color structs.

To use clay with grayscale renderer you would need to define this:

#define CLAY_COLOR uint8_t
#define CLAY_COLOR_RGBA(r, g, b, a) (uint8_t)roundf(0.2126 * (float)r + 0.7152 * (float)g + 0.0722 * (float)b)

If you think this is an ok solution we also need to change two more things in debug view:

  • changing color for highlighted row
  • outputing color string (currently in {r: 0, g: 0, b: 0 a: 0} format)

@nicbarker
Copy link
Owner

Thanks for opening this one, I will take a look today or tomorrow 🙂

@nicbarker
Copy link
Owner

We should also do this for Clay_String I think, most users I suspect will have their own string container struct and it would be nice to avoid duplication boilerplate

@nicbarker nicbarker changed the title Make color type configurable (#75) [Core] Make color type configurable (#75) Dec 26, 2024
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.

2 participants