Pause-Gamesflow
Pause-Games/flow/flow.color
Color parsing and normalized hexadecimal color helpers for Flow.
- GitHub: Pause-Games/flow — pinned to
1.0.0- Pick a release from Pause-Games/flow releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as color from "flow.color"
- Pick a release from Pause-Games/flow releases and add its Source code (zip) URL (or a packaged
Functions
rgb(r: number, g: number, b: number): Flow_ColorValuergba(r: number, g: number, b: number, a: number): Flow_ColorValuehex(value: string): Flow_ColorValuewith_alpha(value: Flow_ColorValue, alpha: number): Flow_ColorValueparse(value: Flow_ColorValue):FlowColorresolve(value: Flow_ColorValue):Vector4
rgb(r: number, g: number, b: number): Flow_ColorValue
Creates an opaque hexadecimal color from normalized or byte-valued channels.
Parameters
r:numberg:numberb:number
Returns
Flow_ColorValue
rgba(r: number, g: number, b: number, a: number): Flow_ColorValue
Creates a hexadecimal color from normalized or byte-valued channels.
Parameters
r:numberg:numberb:numbera:number
Returns
Flow_ColorValue
hex(value: string): Flow_ColorValue
Normalizes a hexadecimal color in #RGB, #RGBA, #RRGGBB, or #RRGGBBAA form.
Parameters
value:string
Returns
Flow_ColorValue
with_alpha(value: Flow_ColorValue, alpha: number): Flow_ColorValue
Returns a color with a replaced alpha channel.
Parameters
value:Flow_ColorValuealpha:number
Returns
Flow_ColorValue
parse(value: Flow_ColorValue): FlowColor
Parses a hexadecimal or CSS named color into normalized channels.
Parameters
value:Flow_ColorValue
Returns
FlowColor
resolve(value: Flow_ColorValue): Vector4
Resolves a hexadecimal or CSS named color to a Defold vector.
Parameters
value:Flow_ColorValue
Returns
Vector4
Types
FlowColorModule
FlowColorModule.__call(r: number, g: number, b: number, a?: number): Flow_ColorValue
Creates a hexadecimal color from normalized or byte-valued channels.
Parameters
r:numberg:numberb:numbera?:number
Returns
Flow_ColorValue
FlowColor
FlowColor.r: number
The red channel.
FlowColor.g: number
The green channel.
FlowColor.b: number
The blue channel.
FlowColor.a: number
The alpha channel.