Skip to content

More string formats #24

Description

@ayoung19

Inspired by color.hex (link) and color.css (link) from Chroma.js, I think colour should support more color formats as Gleam is adopted in more web apps.

I propose the creation of the following functions (refer to the two Chroma.js doc links for more info):

pub fn to_hex_string_rgb(Colour) -> String
pub fn to_hex_string_rgba(Colour) -> String
pub fn to_hex_string_argb(Colour) -> String

pub fn to_css_string_rgb(Colour) -> String
pub fn to_css_string_hsl(Colour) -> String
pub fn to_css_string_lab(Colour) -> String
pub fn to_css_string_lch(Colour) -> String
pub fn to_css_string_oklab(Colour) -> String
pub fn to_css_string_oklch(Colour) -> String

As part of this I also propose deprecating to_rgb_hex_string and to_rgba_hex_string. The above naming convention better groups the related functions together so that they're easier to find in documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions