Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/lucasb-eyer/go-colorful
/ functions
Functions
289 in github.com/lucasb-eyer/go-colorful
⨍
Functions
289
◇
Types & classes
14
↓ 67 callers
Function
almosteq
(v1, v2 float64)
colors_test.go:24
↓ 52 callers
Method
Hex
Hex /// Hex returns the hex "html" representation of the color, as in #ff0080.
colors.go:361
↓ 49 callers
Function
sq
(v float64)
colors.go:84
↓ 32 callers
Method
Float64
()
rand.go:6
↓ 23 callers
Method
AlmostEqualRgb
Check for equality between colors within the tolerance Delta (1/255).
colors.go:132
↓ 20 callers
Function
Hex
Hex parses a "html" hex color-string, either in the 3 "#f0c" or 6 "#ff1034" digits form.
colors.go:367
↓ 18 callers
Function
Lab
Generates a color by using data given in CIE L*a*b* space using D65 as reference white. WARNING: many combinations of `l`, `a`, and `b` values do not
colors.go:658
↓ 18 callers
Function
compareTuple
Two more zeros than the original delta, because values are divided by 100
hsluv_test.go:43
↓ 18 callers
Function
pack
(a, b, c float64)
hsluv_test.go:27
↓ 15 callers
Method
Xyz
XYZ /// http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/
colors.go:527
↓ 13 callers
Method
IsValid
Checks whether the color exists in RGB space, i.e. all values are in [0..1]
colors.go:67
↓ 12 callers
Function
Xyz
(x, y, z float64)
colors.go:531
↓ 11 callers
Function
MustParseHex
This is a very nice thing Golang forces you to do! It is necessary so that we can write out the literal of the colortable below.
doc/gradientgen/gradientgen.go:40
↓ 11 callers
Function
unpack
(tuple [3]float64)
hsluv_test.go:31
↓ 10 callers
Method
Clamped
Returns Clamps the color into valid range, clamping each value to [0..1] If the color is valid already, this is a no-op.
colors.go:80
↓ 10 callers
Method
Lab
Converts the given color to CIE L*a*b* space using D65 as reference white.
colors.go:644
↓ 10 callers
Function
getDefaultGlobalRand
()
rand.go:20
↓ 8 callers
Function
LinearRgb
LinearRgb creates an sRGB color out of the given linear RGB color (see http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/).
colors.go:458
↓ 7 callers
Method
LinearRgb
LinearRgb converts the color into the linear RGB space (see http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/).
colors.go:423
↓ 6 callers
Function
Hsv
Hsv creates a new Color given a Hue in [0..359], a Saturation and a Value in [0..1]
colors.go:191
↓ 6 callers
Method
RGB255
Might come in handy sometimes to reduce boilerplate code.
colors.go:45
↓ 6 callers
Function
clamp01
clamp01 clamps from 0 to 1.
colors.go:74
↓ 6 callers
Function
delinearize
(v float64)
colors.go:450
↓ 6 callers
Function
interp_angle
Utility used by Hxx color-spaces for interpolating between two angles in [0,360].
colors.go:148
↓ 6 callers
Function
linearize
Linear /// http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/ http://www.brucelindbloom.com/Eqn_RGB_to_XYZ.html
colors.go:415
↓ 5 callers
Method
A98Rgb
()
widegamut.go:137
↓ 5 callers
Method
DisplayP3
()
widegamut.go:68
↓ 5 callers
Method
DistanceCIEDE2000
DistanceCIEDE2000 uses the Delta E 2000 formula to calculate color distance. It is more expensive but more accurate than both DistanceLab and Distance
colors.go:722
↓ 5 callers
Method
Intn
(n int)
rand.go:7
↓ 5 callers
Method
Luv
Converts the given color to CIE L*u*v* space using D65 as reference white. L* is in [0..1] and both u* and v* are in about [-1..1]
colors.go:877
↓ 5 callers
Function
LuvToXyzWhiteRef
(l, u, v float64, wref [3]float64)
colors.go:856
↓ 5 callers
Function
MakeColor
Constructs a colorful.Color from something implementing color.Color
colors.go:26
↓ 5 callers
Method
ProPhotoRgb
()
widegamut.go:202
↓ 5 callers
Method
Rec2020
()
widegamut.go:272
↓ 5 callers
Function
almosteq_eps
Dummy for benchmarks to avoid optimization Checks whether the relative error is below eps
colors_test.go:14
↓ 4 callers
Method
BlendHcl
BlendHcl blends two colors in the CIE-L*C*h° color-space, which should result in a smoother blend. t == 0 results in c1, t == 1 results in c2
colors.go:982
↓ 4 callers
Method
HPLuv
HPLuv returns the Hue, Saturation and Luminance of the color in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightnes
hsluv.go:115
↓ 4 callers
Method
HSLuv
HSLuv returns the Hue, Saturation and Luminance of the color in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightnes
hsluv.go:104
↓ 4 callers
Function
Hcl
Generates a color by using data given in HCL space using D65 as reference white. H values are in [0..360], C and L values are in [0..1] WARNING: many
colors.go:960
↓ 4 callers
Method
LuvLCh
LuvLch Converts the given color to LuvLCh space using D65 as reference white. h values are in [0..360], C and L values are in [0..1] although C can ov
colors.go:1001
↓ 4 callers
Function
LuvLChToLuv
(l, c, h float64)
colors.go:1032
↓ 4 callers
Method
LuvLChWhiteRef
Converts the given color to LuvLCh space, taking into account a given reference white. (i.e. the monitor's white) h values are in [0..360], c and l va
colors.go:1020
↓ 4 callers
Function
SoftPaletteExWithRand
Yeah, windows-stype Foo, FooEx, screw you golang... Uses K-means to cluster the color-space and return the means of the clusters as a new palette of d
soft_palettegen.go:34
↓ 4 callers
Method
XyzD50
()
widegamut.go:33
↓ 4 callers
Function
XyzToLinearRgb
XyzToLinearRgb converts from CIE XYZ-space to Linear RGB space.
colors.go:496
↓ 4 callers
Function
XyzToOkLab
(x, y, z float64)
colors.go:1069
↓ 4 callers
Function
delinearizeA98
(v float64)
widegamut.go:101
↓ 4 callers
Function
delinearizeProPhoto
(v float64)
widegamut.go:168
↓ 4 callers
Function
delinearizeRec2020
(v float64)
widegamut.go:238
↓ 4 callers
Method
find
find returns an arbitrary element of a set when invoked on any element of the set, The important feature is that it returns the same value when invoke
sort.go:28
↓ 4 callers
Function
linearizeA98
A98 RGB /// Adobe RGB (1998) color space.
widegamut.go:92
↓ 4 callers
Function
linearizeProPhoto
ProPhoto RGB /// ProPhoto RGB (ROMM RGB) uses D50 illuminant.
widegamut.go:161
↓ 4 callers
Function
linearizeRec2020
(v float64)
widegamut.go:231
↓ 4 callers
Method
values
Used to simplify HSLuv testing.
colors.go:53
↓ 3 callers
Function
A98Rgb
(r, g, b float64)
widegamut.go:131
↓ 3 callers
Method
BlendHsv
You don't really want to use this, do you? Go for BlendLab, BlendLuv or BlendHcl.
colors.go:224
↓ 3 callers
Method
BlendLab
BlendLab blends two colors in the L*a*b* color-space, which should result in a smoother blend. t == 0 results in c1, t == 1 results in c2
colors.go:805
↓ 3 callers
Method
BlendLuv
BlendLuv blends two colors in the CIE-L*u*v* color-space, which should result in a smoother blend. t == 0 results in c1, t == 1 results in c2
colors.go:915
↓ 3 callers
Method
BlendRgb
You don't really want to use this, do you? Go for BlendLab, BlendLuv or BlendHcl.
colors.go:139
↓ 3 callers
Function
DisplayP3
(r, g, b float64)
widegamut.go:62
↓ 3 callers
Method
DistanceCIE76
DistanceCIE76 is the same as DistanceLab.
colors.go:678
↓ 3 callers
Method
DistanceCIE94
Uses the CIE94 formula to calculate color distance. More accurate than DistanceLab, but also more work.
colors.go:684
↓ 3 callers
Method
DistanceLab
DistanceLab is a good measure of visual similarity between two colors! A result of 0 would mean identical colors, while a result of 1 or higher means
colors.go:671
↓ 3 callers
Method
Error
()
hexcolor.go:41
↓ 3 callers
Method
Hcl
HCL /// HCL is nothing else than L*a*b* in cylindrical coordinates! (this was wrong on English wikipedia, I fixed it, let's hope the fix stays.) But
colors.go:932
↓ 3 callers
Method
Hsv
HSV /// From http://en.wikipedia.org/wiki/HSL_and_HSV Note that h is in [0..359] and s,v in [0..1] Hsv returns the Hue [0..359], Saturation and Value
colors.go:161
↓ 3 callers
Function
LabToHcl
(L, a, b float64)
colors.go:936
↓ 3 callers
Method
OkLab
OkLab ///
colors.go:1061
↓ 3 callers
Function
OkLabToOkLch
(l, a, b float64)
colors.go:1125
↓ 3 callers
Function
OkLabToXyz
(l, a, b float64)
colors.go:1079
↓ 3 callers
Function
ProPhotoRgb
(r, g, b float64)
widegamut.go:196
↓ 3 callers
Function
Rec2020
(r, g, b float64)
widegamut.go:266
↓ 3 callers
Function
XyzToLuvWhiteRef
(x, y, z float64, wref [3]float64)
colors.go:825
↓ 3 callers
Function
delinearize_fast
(v float64)
colors.go:462
↓ 3 callers
Function
lab_f
L*a*b* /// http://en.wikipedia.org/wiki/Lab_color_space#CIELAB-CIEXYZ_conversions For L*a*b*, we need to L*a*b*<->XYZ->RGB and the first one is devic
colors.go:601
↓ 3 callers
Function
lab_finv
(t float64)
colors.go:623
↓ 3 callers
Function
linearize_fast
A much faster and still quite precise linearization using a 6th-order Taylor approximation. See the accompanying Jupyter notebook for derivation of th
colors.go:432
↓ 3 callers
Function
xyz_to_uv
For this part, we do as R's graphics.hcl does, not as wikipedia does. Or is it the same?
colors.go:840
↓ 2 callers
Method
BlendA98Rgb
BlendA98Rgb blends two colors in the A98 RGB color-space. t == 0 results in c1, t == 1 results in c2
widegamut.go:148
↓ 2 callers
Method
BlendDisplayP3
BlendDisplayP3 blends two colors in the Display P3 color-space. t == 0 results in c1, t == 1 results in c2
widegamut.go:79
↓ 2 callers
Method
BlendLinearRgb
BlendLinearRgb blends two colors in the Linear RGB color-space. Unlike BlendRgb, this will not produce dark color around the center. t == 0 results in
colors.go:513
↓ 2 callers
Method
BlendLuvLCh
BlendLuvLCh blends two colors in the cylindrical CIELUV color space. t == 0 results in c1, t == 1 results in c2
colors.go:1050
↓ 2 callers
Method
BlendOkLab
BlendOkLab blends two colors in the OkLab color-space, which should result in a better blend (even compared to BlendLab).
colors.go:1096
↓ 2 callers
Method
BlendOkLch
BlendOkLch blends two colors in the OkLch color-space, which should result in a better blend (even compared to BlendHcl).
colors.go:1143
↓ 2 callers
Method
BlendProPhotoRgb
BlendProPhotoRgb blends two colors in the ProPhoto RGB color-space. t == 0 results in c1, t == 1 results in c2
widegamut.go:213
↓ 2 callers
Method
BlendRec2020
BlendRec2020 blends two colors in the Rec. 2020 color-space. t == 0 results in c1, t == 1 results in c2
widegamut.go:283
↓ 2 callers
Function
D50ToD65
Wide-gamut RGB color spaces from CSS Color Level 4. https://www.w3.org/TR/css-color-4/#color-conversion-code Bradford /// Bradford chromatic adaptati
widegamut.go:12
↓ 2 callers
Function
D65ToD50
(x, y, z float64)
widegamut.go:19
↓ 2 callers
Method
DistanceLuv
DistanceLuv is a good measure of visual similarity between two colors! A result of 0 would mean identical colors, while a result of 1 or higher means
colors.go:907
↓ 2 callers
Method
DistanceRgb
DistanceRgb computes the distance between two colors in RGB space. This is not a good measure! Rather do it in Lab space.
colors.go:94
↓ 2 callers
Function
FastHappyColorWithRand
Creates a random bright, "pimpy" color through a restricted HSV space.
colorgens.go:38
↓ 2 callers
Function
FastLinearRgb
FastLinearRgb is much faster than and almost as accurate as LinearRgb. BUT it is important to NOTE that they only produce good results for valid input
colors.go:491
↓ 2 callers
Method
FastLinearRgb
FastLinearRgb is much faster than and almost as accurate as LinearRgb. BUT it is important to NOTE that they only produce good results for valid color
colors.go:443
↓ 2 callers
Function
FastWarmColorWithRand
Creates a random dark, "warm" color through a restricted HSV space.
colorgens.go:6
↓ 2 callers
Function
HPLuv
HPLuv creates a new Color from values in the HPLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. The retu
hsluv.go:95
↓ 2 callers
Function
HPLuvToLuvLCh
(h, s, l float64)
hsluv.go:64
↓ 2 callers
Function
HSLuv
HSLuv creates a new Color from values in the HSLuv color space. Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]. The retu
hsluv.go:84
↓ 2 callers
Function
HSLuvToLuvLCh
(h, s, l float64)
hsluv.go:33
↓ 2 callers
Function
HappyColorWithRand
Creates a random bright, "pimpy" color through restricted HCL space. This is slower than FastHappyColor but will likely give you colors which have the
colorgens.go:52
↓ 2 callers
Function
HclWhiteRef
Generates a color by using data given in HCL space, taking into account a given reference white. (i.e. the monitor's white) H values are in [0..360],
colors.go:975
next →
1–100 of 289, ranked by callers