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

HTML hex colors design #167

bvssvni opened this issue May 16, 2016 · 0 comments


Copy link

commented May 16, 2016

Dyon supports HTML hex colors, e.g. #aaffcc, directly in the syntax. This is converted automatically into vec4 with color components (r/255, g/255, b/255, a/255).

Without alpha:

#aaffcc // alpha is 1

With alpha:

#aaffcc00 // alpha is 0

This is designed for:

  • Easier copying colors from image editors
  • Recognize color settings in meta data syntax, for example a tool to tweak colors while running


The normal color space for image editors is sRGB. When doing interpolation with colors, use srgb_to_linear_color and convert back to sRGB with linear_to_srgb_color.


a := srgb_to_linear(color: #ff0000)
b := srgb_to_linear(color: #00ff00)
t := 0.5
c := linear_to_srgb(color: t * a + (1-t) * b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.