Giter Site home page Giter Site logo

gamut's Introduction

gamut

Latest Release Build Status Coverage Status Go ReportCard GoDoc

Go package to generate and manage color palettes & schemes

import "github.com/muesli/gamut"
import "github.com/muesli/gamut/palette"
import "github.com/muesli/gamut/theme"

Colors

gamut operates on various color spaces internally, but all color values you pass in as parameters and all return values will match Go’s color.Color interface.

Let’s start with the basics. Just for convenience there’s a hex-value parser:

color = gamut.Hex("#333")
color = gamut.Hex("#ABCDEF")

Both the short and standard formats are supported.

Conversely you can retrieve the hex encoding of any color.Color value:

hex = gamut.ToHex(color)

Around the Color Wheel

The Darker and Lighter functions darken and lighten respectively a given color value by a specified percentage, without changing the color's hue:

// returns a 10% darker version of color
color = gamut.Darker(color, 0.1)
// returns a 30% lighter version of color
color = gamut.Lighter(color, 0.3)

Complementary returns the complementary color for a given color:

color = gamut.Complementary(color)

Contrast returns the color with the highest contrast to a given color, either black or white:

color = gamut.Contrast(color)

To retrieve a color with the same lightness and saturation, but a different angle on the color wheel, you can use the HueOffset function:

color = gamut.HueOffset(color, 90)

You can also go in the opposite direction by using negative values.

Schemes

All the following functions return colors of a different hue, but with the same lightness and saturation as the given colors:

Triadic schemes are made up of three hues equally spaced around the color wheel:

colors = gamut.Triadic(color)

Quadratic schemes are made up of four hues equally spaced around the color wheel:

colors = gamut.Quadratic(color)

Tetradic schemes are made up by two colors and their complementary values:

colors = gamut.Tetradic(color1, color2)

Analogous schemes are created by using colors that are next to each other on the color wheel:

colors = gamut.Analogous(color)

SplitComplementary schemes are created by using colors next to the complementary value of a given color:

colors = gamut.SplitComplementary(color)

Warm/Cool Colors

ok = gamut.Warm(color)
ok = gamut.Cool(color)

Shades, Tints & Tones

Monochromatic returns colors of the same hue, but with a different saturation/lightness:

colors = gamut.Monochromatic(color, 8)

Monochromatic Palette

Shades returns colors blended from the given color to black:

colors = gamut.Shades(color, 8)

Shades Palette

Tints returns colors blended from the given color to white:

colors = gamut.Tints(color, 8)

Tints Palette

Tones returns colors blended from the given color to gray:

colors = gamut.Tones(color, 8)

Tones Palette

Blending Colors

Blends returns interpolated colors by blending two colors:

colors = gamut.Blends(color1, color2, 8)

Blends Palette

Palettes

Gamut comes with six curated color palettes: Wikipedia, Crayola, CSS, RAL, Resene, and Monokai. The Wikipedia palette is an import of common colors from Wikipedia’s List of Colors. New curated palettes and importers are welcome. Send me a pull request!

Name Colors Source
Wikipedia 1609 https://en.wikipedia.org/wiki/List_of_colors_(compact)
Crayola 180 https://en.wikipedia.org/wiki/List_of_Crayola_crayon_colors
CSS 147 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
RAL 213 https://en.wikipedia.org/wiki/List_of_RAL_colors
Resene 759 http://www.resene.co.nz
Monokai 17

The function Colors lets you retrieve all colors in a palette:

for _, c := range palette.Wikipedia.Colors() {
    fmt.Println(c.Name, c.Color)
}

This will print out a list of 1609 color names, as defined by Wikipedia.

Creating Your Own Palettes

var p gamut.Palette
p.AddColors(
    gamut.Colors{
        {"Name", gamut.Hex("#123456"), "Reference"},
        ...
    }
)

Name and Reference are optional when creating your own palettes.

Names

Each color in the curated palettes comes with an “official” name. You can filter palettes by colors with specific names. This code snippet will return a list of all “blue” colors in the Wikipedia palette:

colors = palette.Wikipedia.Filter("blue")

You can access a color with a specific name using the Color function:

color, ok = palette.Wikipedia.Color("Pastel blue")

Calling a palette’s Name function with a given color returns the name & distance of the closest (perceptually) matching color in it:

name, distance = palette.Wikipedia.Name(color)
// name = "Baby blue"
// distance between 0.0 and 1.0

Mixing Palettes

You can combine all colors of two palettes by mixing them:

p = palette.Crayola.MixedWith(palette.Monokai)

Perception

Sometimes you got a slice of colors, but you have a limited color palette to work with. The Clamped function returns a slice of the closest perceptually matching colors in a palette, maintaining the same order as the original slice you provided. Finally you can remix your favorite wallpapers in Crayola-style!

colors = palette.Crayola.Clamped(colors)

Generating Color Palettes

Color Generators, like the provided PastelGenerator, WarmGenerator or HappyGenerator can produce random (within the color space constraints of the generator) color palettes:

colors, err = gamut.Generate(8, gamut.PastelGenerator{})

Pastel Palette

The SimilarHueGenerator produces colors with a hue similar to a given color:

colors, err = gamut.Generate(8, gamut.SimilarHueGenerator{Color: gamut.Hex("#2F1B82")})

Similar Hue Palette

Using the ColorGenerator interface, you can also write your own color generators:

type BrightGenerator struct {
	BroadGranularity
}

func (cc BrightGenerator) Valid(col colorful.Color) bool {
	_, _, l := col.Lab()
	return 0.7 <= l && l <= 1.0
}

...
colors, err := gamut.Generate(8, BrightGenerator{})

Only colors with a lightness between 0.7 and 1.0 will be accepted by this generator.

Themes

Name Colors
Monokai 7

Roles

color = theme.MonokaiTheme.Role(theme.Foreground)

Available roles are Foreground, Background, Base, AlternateBase, Text, Selection, Highlight.

Feedback

Got some feedback or suggestions? Please open an issue or drop me a note!

gamut's People

Contributors

0xflotus avatar dependabot[bot] avatar haraldnordgren avatar meowgorithm avatar muesli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gamut's Issues

Unexpected results for darken() and lighten()

I try to darken / lighten (0.1, 0.2, ... 0.8) a given color and get some unexpected (?) results. What's going wrong?

...
value := "#ea621f" // 'Red-Orange'
c, err := colorful.Hex(value)
if err != nil {
	log.Fatalf("error <%v> at colorful.Hex(), value = %s", err, value)
}
var farbreihe []color.Color

// color properties
isWarm := gamut.Warm(c)
isCool := gamut.Cool(c)
temperature := ""
if isWarm {
	temperature = "warm"
} else if isCool {
	temperature = "cool"
} else {
	temperature = "Unknown Temperature"
}

// color
farbreihe = nil
farbreihe = append(farbreihe, c)
farbreihe = append(farbreihe, gamut.Contrast(c))
Table(buffer, fmt.Sprintf("Color (%s) and most Contrast Color", temperature), farbreihe)

// darker
farbreihe = nil
farbreihe = append(farbreihe, c)
for i := 1; i <= 8; i++ {
	percent := 0.1 * float64(i)
	farbreihe = append(farbreihe, gamut.Darker(c, percent))
}
Table(buffer, "Darker (darken the given color: 10%, 20%, ...)", farbreihe)

// lighter
farbreihe = nil
farbreihe = append(farbreihe, c)
for i := 1; i <= 8; i++ {
	percent := 0.1 * float64(i)
	farbreihe = append(farbreihe, gamut.Lighter(c, percent))
}
Table(buffer, "Lighter (lighten the given color: 10%, 20%, ...)", farbreihe)

And that's the result I get (the values for 20%, 30%, ... are unexpected):

Bildschirmfoto 2020-11-01 um 14 49 02

Masking for common colour blindnesses?

Hi,
Great API. I was curious as to if you have considered support for, (or maybe clamping examples for), supporting the various forms of colour blindness for palette generation? I've not found many APIs supporting it. It's an interesting area, and something I've wanting to be able to do for graphs/charts before.

calling Darker() on a dark color can return a lighter color

Great library - thanks for making it. One small thing I noticed is that calling Darker() on a dark RGB color can actually return a lighter RGB color. It would be more intuitive (at least to me!) if it clamped to black. On a related note it would be useful to have helper functions like IsDarker(color1, color2) bool and GetContrast(color1, color2) in the package.

RAL palette

I have added the RAL color palette to my application. If it's of interest I could create a pull request.

/*
addRALColors adds RAL colors as palette (RAL source: https://gist.github.com/lunohodov/1995178)
*/
func addRALColors() {
	RAL.AddColors(
		gamut.Colors{
			{"Green beige", gamut.Hex("#BEBD7F"), "RAL 1000"},
			{"Beige", gamut.Hex("#C2B078"), "RAL 1001"},
			{"Sand yellow", gamut.Hex("#C6A664"), "RAL 1002"},
			{"Signal yellow", gamut.Hex("#E5BE01"), "RAL 1003"},
			{"Golden yellow", gamut.Hex("#CDA434"), "RAL 1004"},
			{"Honey yellow", gamut.Hex("#A98307"), "RAL 1005"},
			{"Maize yellow", gamut.Hex("#E4A010"), "RAL 1006"},
			{"Daffodil yellow", gamut.Hex("#DC9D00"), "RAL 1007"},
			{"Brown beige", gamut.Hex("#8A6642"), "RAL 1011"},
			{"Lemon yellow", gamut.Hex("#C7B446"), "RAL 1012"},
			{"Oyster white", gamut.Hex("#EAE6CA"), "RAL 1013"},
			{"Ivory", gamut.Hex("#E1CC4F"), "RAL 1014"},
			{"Light ivory", gamut.Hex("#E6D690"), "RAL 1015"},
			{"Sulfur yellow", gamut.Hex("#EDFF21"), "RAL 1016"},
			{"Saffron yellow", gamut.Hex("#F5D033"), "RAL 1017"},
			{"Zinc yellow", gamut.Hex("#F8F32B"), "RAL 1018"},
			{"Grey beige", gamut.Hex("#9E9764"), "RAL 1019"},
			{"Olive yellow", gamut.Hex("#999950"), "RAL 1020"},
			{"Rape yellow", gamut.Hex("#F3DA0B"), "RAL 1021"},
			{"Traffic yellow", gamut.Hex("#FAD201"), "RAL 1023"},
			{"Ochre yellow", gamut.Hex("#AEA04B"), "RAL 1024"},
			{"Luminous yellow", gamut.Hex("#FFFF00"), "RAL 1026"},
			{"Curry", gamut.Hex("#9D9101"), "RAL 1027"},
			{"Melon yellow", gamut.Hex("#F4A900"), "RAL 1028"},
			{"Broom yellow", gamut.Hex("#D6AE01"), "RAL 1032"},
			{"Dahlia yellow", gamut.Hex("#F3A505"), "RAL 1033"},
			{"Pastel yellow", gamut.Hex("#EFA94A"), "RAL 1034"},
			{"Pearl beige", gamut.Hex("#6A5D4D"), "RAL 1035"},
			{"Pearl gold", gamut.Hex("#705335"), "RAL 1036"},
			{"Sun yellow", gamut.Hex("#F39F18"), "RAL 1037"},
			{"Yellow orange", gamut.Hex("#ED760E"), "RAL 2000"},
			{"Red orange", gamut.Hex("#C93C20"), "RAL 2001"},
			{"Vermilion", gamut.Hex("#CB2821"), "RAL 2002"},
			{"Pastel orange", gamut.Hex("#FF7514"), "RAL 2003"},
			{"Pure orange", gamut.Hex("#F44611"), "RAL 2004"},
			{"Luminous orange", gamut.Hex("#FF2301"), "RAL 2005"},
			{"Luminous bright orange", gamut.Hex("#FFA420"), "RAL 2007"},
			{"Bright red orange", gamut.Hex("#F75E25"), "RAL 2008"},
			{"Traffic orange", gamut.Hex("#F54021"), "RAL 2009"},
			{"Signal orange", gamut.Hex("#D84B20"), "RAL 2010"},
			{"Deep orange", gamut.Hex("#EC7C26"), "RAL 2011"},
			{"Salmon range", gamut.Hex("#E55137"), "RAL 2012"},
			{"Pearl orange", gamut.Hex("#C35831"), "RAL 2013"},
			{"Flame red", gamut.Hex("#AF2B1E"), "RAL 3000"},
			{"Signal red", gamut.Hex("#A52019"), "RAL 3001"},
			{"Carmine red", gamut.Hex("#A2231D"), "RAL 3002"},
			{"Ruby red", gamut.Hex("#9B111E"), "RAL 3003"},
			{"Purple red", gamut.Hex("#75151E"), "RAL 3004"},
			{"Wine red", gamut.Hex("#5E2129"), "RAL 3005"},
			{"Black red", gamut.Hex("#412227"), "RAL 3007"},
			{"Oxide red", gamut.Hex("#642424"), "RAL 3009"},
			{"Brown red", gamut.Hex("#781F19"), "RAL 3011"},
			{"Beige red", gamut.Hex("#C1876B"), "RAL 3012"},
			{"Tomato red", gamut.Hex("#A12312"), "RAL 3013"},
			{"Antique pink", gamut.Hex("#D36E70"), "RAL 3014"},
			{"Light pink", gamut.Hex("#EA899A"), "RAL 3015"},
			{"Coral red", gamut.Hex("#B32821"), "RAL 3016"},
			{"Rose", gamut.Hex("#E63244"), "RAL 3017"},
			{"Strawberry red", gamut.Hex("#D53032"), "RAL 3018"},
			{"Traffic red", gamut.Hex("#CC0605"), "RAL 3020"},
			{"Salmon pink", gamut.Hex("#D95030"), "RAL 3022"},
			{"Luminous red", gamut.Hex("#F80000"), "RAL 3024"},
			{"Luminous bright red", gamut.Hex("#FE0000"), "RAL 3026"},
			{"Raspberry red", gamut.Hex("#C51D34"), "RAL 3027"},
			{"Pure red", gamut.Hex("#CB3234"), "RAL 3028"},
			{"Orient red", gamut.Hex("#B32428"), "RAL 3031"},
			{"Pearl ruby red", gamut.Hex("#721422"), "RAL 3032"},
			{"Pearl pink", gamut.Hex("#B44C43"), "RAL 3033"},
			{"Red lilac", gamut.Hex("#6D3F5B"), "RAL 4001"},
			{"Red violet", gamut.Hex("#922B3E"), "RAL 4002"},
			{"Heather violet", gamut.Hex("#DE4C8A"), "RAL 4003"},
			{"Claret violet", gamut.Hex("#641C34"), "RAL 4004"},
			{"Blue lilac", gamut.Hex("#6C4675"), "RAL 4005"},
			{"Traffic purple", gamut.Hex("#A03472"), "RAL 4006"},
			{"Purple violet", gamut.Hex("#4A192C"), "RAL 4007"},
			{"Signal violet", gamut.Hex("#924E7D"), "RAL 4008"},
			{"Pastel violet", gamut.Hex("#A18594"), "RAL 4009"},
			{"Telemagenta", gamut.Hex("#CF3476"), "RAL 4010"},
			{"Pearl violet", gamut.Hex("#8673A1"), "RAL 4011"},
			{"Pearl black berry", gamut.Hex("#6C6874"), "RAL 4012"},
			{"Violet blue", gamut.Hex("#354D73"), "RAL 5000"},
			{"Green blue", gamut.Hex("#1F3438"), "RAL 5001"},
			{"Ultramarine blue", gamut.Hex("#20214F"), "RAL 5002"},
			{"Saphire blue", gamut.Hex("#1D1E33"), "RAL 5003"},
			{"Black blue", gamut.Hex("#18171C"), "RAL 5004"},
			{"Signal blue", gamut.Hex("#1E2460"), "RAL 5005"},
			{"Brillant blue", gamut.Hex("#3E5F8A"), "RAL 5007"},
			{"Grey blue", gamut.Hex("#26252D"), "RAL 5008"},
			{"Azure blue", gamut.Hex("#025669"), "RAL 5009"},
			{"Gentian blue", gamut.Hex("#0E294B"), "RAL 5010"},
			{"Steel blue", gamut.Hex("#231A24"), "RAL 5011"},
			{"Light blue", gamut.Hex("#3B83BD"), "RAL 5012"},
			{"Cobalt blue", gamut.Hex("#1E213D"), "RAL 5013"},
			{"Pigeon blue", gamut.Hex("#606E8C"), "RAL 5014"},
			{"Sky blue", gamut.Hex("#2271B3"), "RAL 5015"},
			{"Traffic blue", gamut.Hex("#063971"), "RAL 5017"},
			{"Turquoise blue", gamut.Hex("#3F888F"), "RAL 5018"},
			{"Capri blue", gamut.Hex("#1B5583"), "RAL 5019"},
			{"Ocean blue", gamut.Hex("#1D334A"), "RAL 5020"},
			{"Water blue", gamut.Hex("#256D7B"), "RAL 5021"},
			{"Night blue", gamut.Hex("#252850"), "RAL 5022"},
			{"Distant blue", gamut.Hex("#49678D"), "RAL 5023"},
			{"Pastel blue", gamut.Hex("#5D9B9B"), "RAL 5024"},
			{"Pearl gentian blue", gamut.Hex("#2A6478"), "RAL 5025"},
			{"Pearl night blue", gamut.Hex("#102C54"), "RAL 5026"},
			{"Patina green", gamut.Hex("#316650"), "RAL 6000"},
			{"Emerald green", gamut.Hex("#287233"), "RAL 6001"},
			{"Leaf green", gamut.Hex("#2D572C"), "RAL 6002"},
			{"Olive green", gamut.Hex("#424632"), "RAL 6003"},
			{"Blue green", gamut.Hex("#1F3A3D"), "RAL 6004"},
			{"Moss green", gamut.Hex("#2F4538"), "RAL 6005"},
			{"Grey olive", gamut.Hex("#3E3B32"), "RAL 6006"},
			{"Bottle green", gamut.Hex("#343B29"), "RAL 6007"},
			{"Brown green", gamut.Hex("#39352A"), "RAL 6008"},
			{"Fir green", gamut.Hex("#31372B"), "RAL 6009"},
			{"Grass green", gamut.Hex("#35682D"), "RAL 6010"},
			{"Reseda green", gamut.Hex("#587246"), "RAL 6011"},
			{"Black green", gamut.Hex("#343E40"), "RAL 6012"},
			{"Reed green", gamut.Hex("#6C7156"), "RAL 6013"},
			{"Yellow olive", gamut.Hex("#47402E"), "RAL 6014"},
			{"Black olive", gamut.Hex("#3B3C36"), "RAL 6015"},
			{"Turquoise green", gamut.Hex("#1E5945"), "RAL 6016"},
			{"May green", gamut.Hex("#4C9141"), "RAL 6017"},
			{"Yellow green", gamut.Hex("#57A639"), "RAL 6018"},
			{"Pastel green", gamut.Hex("#BDECB6"), "RAL 6019"},
			{"Chrome green", gamut.Hex("#2E3A23"), "RAL 6020"},
			{"Pale green", gamut.Hex("#89AC76"), "RAL 6021"},
			{"Olive drab", gamut.Hex("#25221B"), "RAL 6022"},
			{"Traffic green", gamut.Hex("#308446"), "RAL 6024"},
			{"Fern green", gamut.Hex("#3D642D"), "RAL 6025"},
			{"Opal green", gamut.Hex("#015D52"), "RAL 6026"},
			{"Light green", gamut.Hex("#84C3BE"), "RAL 6027"},
			{"Pine green", gamut.Hex("#2C5545"), "RAL 6028"},
			{"Mint green", gamut.Hex("#20603D"), "RAL 6029"},
			{"Signal green", gamut.Hex("#317F43"), "RAL 6032"},
			{"Mint turquoise", gamut.Hex("#497E76"), "RAL 6033"},
			{"Pastel turquoise", gamut.Hex("#7FB5B5"), "RAL 6034"},
			{"Pearl green", gamut.Hex("#1C542D"), "RAL 6035"},
			{"Pearl opal green", gamut.Hex("#193737"), "RAL 6036"},
			{"Pure green", gamut.Hex("#008F39"), "RAL 6037"},
			{"Luminous green", gamut.Hex("#00BB2D"), "RAL 6038"},
			{"Squirrel grey", gamut.Hex("#78858B"), "RAL 7000"},
			{"Silver grey", gamut.Hex("#8A9597"), "RAL 7001"},
			{"Olive grey", gamut.Hex("#7E7B52"), "RAL 7002"},
			{"Moss grey", gamut.Hex("#6C7059"), "RAL 7003"},
			{"Signal grey", gamut.Hex("#969992"), "RAL 7004"},
			{"Mouse grey", gamut.Hex("#646B63"), "RAL 7005"},
			{"Beige grey", gamut.Hex("#6D6552"), "RAL 7006"},
			{"Khaki grey", gamut.Hex("#6A5F31"), "RAL 7008"},
			{"Green grey", gamut.Hex("#4D5645"), "RAL 7009"},
			{"Tarpaulin grey", gamut.Hex("#4C514A"), "RAL 7010"},
			{"Iron grey", gamut.Hex("#434B4D"), "RAL 7011"},
			{"Basalt grey", gamut.Hex("#4E5754"), "RAL 7012"},
			{"Brown grey", gamut.Hex("#464531"), "RAL 7013"},
			{"Slate grey", gamut.Hex("#434750"), "RAL 7015"},
			{"Anthracite grey", gamut.Hex("#293133"), "RAL 7016"},
			{"Black grey", gamut.Hex("#23282B"), "RAL 7021"},
			{"Umbra grey", gamut.Hex("#332F2C"), "RAL 7022"},
			{"Concrete grey", gamut.Hex("#686C5E"), "RAL 7023"},
			{"Graphite grey", gamut.Hex("#474A51"), "RAL 7024"},
			{"Granite grey", gamut.Hex("#2F353B"), "RAL 7026"},
			{"Stone grey", gamut.Hex("#8B8C7A"), "RAL 7030"},
			{"Blue grey", gamut.Hex("#474B4E"), "RAL 7031"},
			{"Pebble grey", gamut.Hex("#B8B799"), "RAL 7032"},
			{"Cement grey", gamut.Hex("#7D8471"), "RAL 7033"},
			{"Yellow grey", gamut.Hex("#8F8B66"), "RAL 7034"},
			{"Light grey", gamut.Hex("#CBD0CC"), "RAL 7035"},
			{"Platinum grey", gamut.Hex("#7F7679"), "RAL 7036"},
			{"Dusty grey", gamut.Hex("#7D7F7D"), "RAL 7037"},
			{"Agate grey", gamut.Hex("#B5B8B1"), "RAL 7038"},
			{"Quartz grey", gamut.Hex("#6C6960"), "RAL 7039"},
			{"Window grey", gamut.Hex("#9DA1AA"), "RAL 7040"},
			{"Traffic grey A", gamut.Hex("#8D948D"), "RAL 7042"},
			{"Traffic grey B", gamut.Hex("#4E5452"), "RAL 7043"},
			{"Silk grey", gamut.Hex("#CAC4B0"), "RAL 7044"},
			{"Telegrey 1", gamut.Hex("#909090"), "RAL 7045"},
			{"Telegrey 2", gamut.Hex("#82898F"), "RAL 7046"},
			{"Telegrey 4", gamut.Hex("#D0D0D0"), "RAL 7047"},
			{"Pearl mouse grey", gamut.Hex("#898176"), "RAL 7048"},
			{"Green brown", gamut.Hex("#826C34"), "RAL 8000"},
			{"Ochre brown", gamut.Hex("#955F20"), "RAL 8001"},
			{"Signal brown", gamut.Hex("#6C3B2A"), "RAL 8002"},
			{"Clay brown", gamut.Hex("#734222"), "RAL 8003"},
			{"Copper brown", gamut.Hex("#8E402A"), "RAL 8004"},
			{"Fawn brown", gamut.Hex("#59351F"), "RAL 8007"},
			{"Olive brown", gamut.Hex("#6F4F28"), "RAL 8008"},
			{"Nut brown", gamut.Hex("#5B3A29"), "RAL 8011"},
			{"Red brown", gamut.Hex("#592321"), "RAL 8012"},
			{"Sepia brown", gamut.Hex("#382C1E"), "RAL 8014"},
			{"Chestnut brown", gamut.Hex("#633A34"), "RAL 8015"},
			{"Mahogany brown", gamut.Hex("#4C2F27"), "RAL 8016"},
			{"Chocolate brown", gamut.Hex("#45322E"), "RAL 8017"},
			{"Grey brown", gamut.Hex("#403A3A"), "RAL 8019"},
			{"Black brown", gamut.Hex("#212121"), "RAL 8022"},
			{"Orange brown", gamut.Hex("#A65E2E"), "RAL 8023"},
			{"Beige brown", gamut.Hex("#79553D"), "RAL 8024"},
			{"Pale brown", gamut.Hex("#755C48"), "RAL 8025"},
			{"Terra brown", gamut.Hex("#4E3B31"), "RAL 8028"},
			{"Pearl copper", gamut.Hex("#763C28"), "RAL 8029"},
			{"Cream", gamut.Hex("#FDF4E3"), "RAL 9001"},
			{"Grey white", gamut.Hex("#E7EBDA"), "RAL 9002"},
			{"Signal white", gamut.Hex("#F4F4F4"), "RAL 9003"},
			{"Signal black", gamut.Hex("#282828"), "RAL 9004"},
			{"Jet black", gamut.Hex("#0A0A0A"), "RAL 9005"},
			{"White aluminium", gamut.Hex("#A5A5A5"), "RAL 9006"},
			{"Grey aluminium", gamut.Hex("#8F8F8F"), "RAL 9007"},
			{"Pure white", gamut.Hex("#FFFFFF"), "RAL 9010"},
			{"Graphite black", gamut.Hex("#1C1C1C"), "RAL 9011"},
			{"Traffic white", gamut.Hex("#F6F6F6"), "RAL 9016"},
			{"Traffic black", gamut.Hex("#1E1E1E"), "RAL 9017"},
			{"Papyrus white", gamut.Hex("#CFD3CD"), "RAL 9018"},
			{"Pearl light grey", gamut.Hex("#9C9C9C"), "RAL 9022"},
			{"Pearl dark grey", gamut.Hex("#828282"), "RAL 9023"},
		})
}

Bildschirmfoto 2020-11-06 um 17 28 15

go vet warning "composite literal uses unkeyed fields"

You can avoid this go vet warning:

...
gamut.Colors{
	{"Kadminumrot", gamut.Hex(fmt.Sprintf("#%02x%02x%02x", 230, 50, 0)), "Rot-1"},
	{Name: "Signalrot", Color: gamut.Hex(fmt.Sprintf("#%02x%02x%02x", 225, 0, 0)), Reference: "Rot-2"},
...

The first definition ("Kadminumrot", ...) produces the warning, the second definition (Name: "Signalrot", ...) does not.

https://stackoverflow.com/questions/54548441/composite-literal-uses-unkeyed-fields: Ignoring this vet warning has the potential to lead to really nasty and hard to track down runtime bugs, so you'd be better off if you were to always specify the keys of 3rd party structs explicitly.

It's a cosmetic change because you are the owner and not a user of the lib. The warning can easily be removed in your lib with search and replace.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.