Skip to content

HTML hex colors design #167

Description

@bvssvni

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

Notice

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.

Example:

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions