Trên GitHub, muesli/gamut đã đạt 576 sao, ngôn ngữ Go. Go package to generate and manage color palettes & schemes 🎨
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
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)
Shades returns colors blended from the given color to black:
colors = gamut.Shades(color, 8)
Tints returns colors blended from the given color to white:
colors = gamut.Tints(color, 8)
Tones returns colors blended from the given color to gray:
colors = gamut.Tones(color, 8)
Blending Colors
Blends returns interpolated colors by blending two colors:
colors = gamut.Blends(color1, color2, 8)
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!
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:
muesli/gamut có 576 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/muesli/gamut. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
muesli/gamut có những chủ đề gì?
GitHub topics của muesli/gamut: "color-blending", "color-palettes", "color-schemes", "color-wheel", "gamut", "hue", "themes", "tints". TopGit xếp repo vào nhóm mã nguồn mở.
muesli/gamut còn đang phát triển không?
Commit gần nhất trên muesli/gamut là 8 ngày trước (theo timestamp GitHub). Repo có 31 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
muesli/gamut là gì?
muesli/gamut (muesli/gamut) là dự án Go trên GitHub. Theo mô tả gốc: Go package to generate and manage color palettes & schemes 🎨
muesli/gamut viết bằng ngôn ngữ gì?
muesli/gamut chủ yếu viết bằng Go. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về gamut?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về gamut.