navigation

Creating colors from input

FSharpColors supports parsing both raw color values and string representations (often found on the web) of them

(a)rgb

Color.fromARGB 100 100 100 100
Color.fromARGBString "argb(100,100,100,100)"

Color.fromRGB 100 100 100
Color.fromRGBString "rgb(100,100,100)"

cmyk

Color.fromCMYK 0. 0. 0. 0.60
Color.fromCMYKString "cmyk(0%,0%,0%,60%)"

Hex

//for hex strings, parsing both with and without the prefix is supported
Color.fromHexString "FFFFFF"
Color.fromHexString "0xFFFFFF"

Webcolors

Color.fromWebColorString "#FFFFFF"
Color.fromStandardWebColor StandardWebColor.AntiqueWhite
namespace FSharpColors
type Color =
  { A: byte
    R: byte
    G: byte
    B: byte }
    static member fromARGB : a:int -> r:int -> g:int -> b:int -> Color
    static member fromARGBString : argbString:string -> Color
    static member fromCMYK : c:float -> m:float -> y:float -> k:float -> Color
    static member fromCMYKString : cmykString:string -> Color
    static member fromColorKeyword : keyWord:string -> Color
    static member fromHexString : s:string -> Color
    static member fromRGB : r:int -> g:int -> b:int -> Color
    static member fromRGBString : rgbString:string -> Color
    static member fromStandardWebColor : swc:StandardWebColor -> Color
    static member fromWebColorString : s:string -> Color
    ...
static member Color.fromARGB : a:int -> r:int -> g:int -> b:int -> Color
static member Color.fromARGBString : argbString:string -> Color
static member Color.fromRGB : r:int -> g:int -> b:int -> Color
static member Color.fromRGBString : rgbString:string -> Color
static member Color.fromCMYK : c:float -> m:float -> y:float -> k:float -> Color
static member Color.fromCMYKString : cmykString:string -> Color
static member Color.fromHexString : s:string -> Color
static member Color.fromWebColorString : s:string -> Color
static member Color.fromStandardWebColor : swc:StandardWebColor -> Color
type StandardWebColor =
  | AliceBlue
  | AntiqueWhite
  | Aqua
  | Aquamarine
  | Azure
  | Beige
  | Bisque
  | Black
  | BlanchedAlmond
  | Blue
  ...
    static member ofKeyWord : (string -> StandardWebColor)
    static member toRGB : (StandardWebColor -> int * int * int)
    static member ofRGB : r:int -> g:int -> b:int -> StandardWebColor
union case StandardWebColor.AntiqueWhite: StandardWebColor