All Projects → muesli → Gamut

muesli / Gamut

Licence: mit
Go package to generate and manage color palettes & schemes 🎨

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Gamut

Betterdiscordaddons
A series of plugins and themes for BetterDiscord.
Stars: ✭ 310 (-25.48%)
Mutual labels:  themes
Cxjs
CxJS - Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.
Stars: ✭ 345 (-17.07%)
Mutual labels:  themes
Vscode Theme Generator
Easily generate themes for VS Code with only a few colors
Stars: ✭ 393 (-5.53%)
Mutual labels:  themes
Hue
🎨 Hue is the all-in-one coloring utility that you'll ever need.
Stars: ✭ 3,306 (+694.71%)
Mutual labels:  hue
Home Assistantconfig
🏠 Home Assistant configuration & Documentation for my Smart House. Write-ups, videos, part lists, and links throughout. Be sure to ⭐ it. Updated FREQUENTLY!
Stars: ✭ 3,687 (+786.3%)
Mutual labels:  hue
Stylist
A stylist creates cool styles. Stylist is a Gradle plugin that codegens a base set of Android XML themes.
Stars: ✭ 354 (-14.9%)
Mutual labels:  themes
Themecreator
https://mswift42.github.io/themecreator/ create themes for intellij, textmate, atom, emacs, vim and gnome terminal.
Stars: ✭ 303 (-27.16%)
Mutual labels:  themes
Termux Style
Simple script to change color-schemes and fonts for Termux.
Stars: ✭ 400 (-3.85%)
Mutual labels:  themes
Xaringanthemer
😎 Give your xaringan slides some style
Stars: ✭ 337 (-18.99%)
Mutual labels:  themes
Iterm2 Color Schemes
Over 250 terminal color schemes/themes for iTerm/iTerm2. Includes ports to Terminal, Konsole, PuTTY, Xresources, XRDB, Remmina, Termite, XFCE, Tilda, FreeBSD VT, Terminator, Kitty, MobaXterm, LXTerminal, Microsoft's Windows Terminal, Visual Studio, Alacritty
Stars: ✭ 20,828 (+4906.73%)
Mutual labels:  themes
Coolhue
Coolest Gradient Hues and Swatches
Stars: ✭ 3,307 (+694.95%)
Mutual labels:  hue
Rigel
🌌 Colorscheme for vim, terminal, vscode and slack - based on the star Rigel ✨.
Stars: ✭ 324 (-22.12%)
Mutual labels:  themes
Hue Sensors Hass
Support for Hue motion sensors and device tracker
Stars: ✭ 353 (-15.14%)
Mutual labels:  hue
Ulaunch
🚀 Custom, open-source qlaunch (Nintendo Switch HOME menu) replacement/reimplementation
Stars: ✭ 313 (-24.76%)
Mutual labels:  themes
Huejay
Philips Hue client for Node.js
Stars: ✭ 395 (-5.05%)
Mutual labels:  hue
Hue
Work with Philips Hue from Ruby
Stars: ✭ 308 (-25.96%)
Mutual labels:  hue
Kube
Kube is a professional and a responsive Hugo theme for developers and designers that offers a documentation section mixed with a landing page and a blog.
Stars: ✭ 349 (-16.11%)
Mutual labels:  themes
Django Flat Theme
A flat theme for Django admin interface. Modern, fresh, simple.
Stars: ✭ 415 (-0.24%)
Mutual labels:  themes
Wordpress Theme Puock
🎨 一款基于WordPress开发的高颜值的自适应主题,支持白天与黑夜模式、无刷新加载等。
Stars: ✭ 394 (-5.29%)
Mutual labels:  themes
Theme Specification
A specification for defining theme objects & design tokens for use with UI components
Stars: ✭ 374 (-10.1%)
Mutual labels:  themes

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.

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].