bitbybit.dev v1.0.0-rc.1
    Preparing search index...

    Class Color

    Index

    Constructors

    convert

    • Converts hex color to RGB object with r, g, b values (0-255 range). Example: '#FF5733' → {r: 255, g: 87, b: 51}

      Parameters

      Returns ColorRGB

      rgb color

      hex to rgb

      false

    • Converts RGB values to hex color string (supports custom min/max ranges, auto-remaps to 0-255). Example: r=255, g=87, b=51 with range [0,255] → '#ff5733' Example: r=1, g=0.5, b=0.2 with range [0,1] → '#ff7f33'

      Parameters

      Returns string

      hex color

      rgb to hex

      false

    • Converts RGB object to hex color string (supports custom min/max ranges). Example: {r: 1, g: 0.5, b: 0.2} with range [0,1] → '#ff7f33'

      Parameters

      Returns string

      hex color string

      rgb obj to hex

      false

    • Converts hex color to RGB and remaps values to a custom range. Example: '#FF5733' mapped to [0,1] → {r: 1, g: 0.341, b: 0.2} Example: '#FF5733' mapped to [0,100] → {r: 100, g: 34.1, b: 20}

      Parameters

      Returns ColorRGB

      rgb color

      hex to rgb mapped

      false

    create

    • Creates and returns a hex color string (pass-through for color input). Example: '#FF5733' → '#FF5733'

      Parameters

      Returns string

      color string

      color hex

      false

    • Creates and returns rgb color object

      Parameters

      Returns ColorRGB

      color object

      color rgb 0-255

      false

    • Creates and returns rgb color object

      Parameters

      Returns ColorRGB

      color object

      color rgb 0-1

      false

    • Creates and returns rgba color object

      Parameters

      Returns ColorRGBA

      color object

      color rgba 0-255

      false

    • Creates and returns rgba color object

      Parameters

      Returns ColorRGBA

      color object

      color rgba 0-1

      false

    • Creates atomic rgb color object

      Parameters

      Returns ColorRGB

      color object

      atomic color rgb 0-1

      false

    hex to

    • Extracts the red channel value from hex color (can be mapped to custom range). Example: '#FF5733' with range [0,1] → 1

      Parameters

      Returns number

      rgb color

      red

      false

    • Extracts the green channel value from hex color (can be mapped to custom range). Example: '#FF5733' with range [0,1] → 0.341

      Parameters

      Returns number

      rgb color

      green

      false

    • Extracts the blue channel value from hex color (can be mapped to custom range). Example: '#FF5733' with range [0,1] → 0.2

      Parameters

      Returns number

      blue param

      blue

      false

    • Inverts a hex color (flips RGB channels: 255-r, 255-g, 255-b). With blackAndWhite=true → returns '#000000' or '#ffffff' based on brightness. Example: '#FF5733' → '#00a8cc', '#FF5733' with blackAndWhite=true → '#ffffff'

      Parameters

      Returns string

      inverted color

      invert color

      false

    rgb to

    • Extracts the red channel value from RGB object. Example: {r: 255, g: 87, b: 51} → 255

      Parameters

      Returns number

      red param

      red

      false

    • Extracts the green channel value from RGB object. Example: {r: 255, g: 87, b: 51} → 87

      Parameters

      Returns number

      green param

      green

      false

    • Extracts the blue channel value from RGB object. Example: {r: 255, g: 87, b: 51} → 51

      Parameters

      Returns number

      blue param

      blue

      false