https://github.com/somebadcode/go-colorx
Extra color models for Go
https://github.com/somebadcode/go-colorx
color color-model color-models colors colour colour-spaces css css-color css-colors go golang hsl hsla hsv hsv2rgb hsva rgb2hsv
Last synced: about 1 month ago
JSON representation
Extra color models for Go
- Host: GitHub
- URL: https://github.com/somebadcode/go-colorx
- Owner: somebadcode
- License: mit
- Created: 2021-04-05T14:08:26.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-08T22:53:42.000Z (over 3 years ago)
- Last Synced: 2025-01-27T06:44:40.813Z (3 months ago)
- Topics: color, color-model, color-models, colors, colour, colour-spaces, css, css-color, css-colors, go, golang, hsl, hsla, hsv, hsv2rgb, hsva, rgb2hsv
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# colorx - extra color models
This package contains extra color models to complement the models in `image/color`. By using a different color model
than the default `color.RGBA` model, you can specify or modify the color in a different way.**Import:** `github.com/somebadcode/go-colorx/v2`
### HSV/HSB - Hue, Saturation, Value/Brightness
HSV is implemented through the concrete type `HSVA`. The HSV color model was designed to more closely reflect how
humans perceive colors. You can use HSV to generate gradients or a color palette for graphs that are easier to perceive
for colorblind users. You can also use this color model to make images monochrome or have more saturated colors.### HSL - Hue, Saturation, Lightness
HSL is similar to HSV and can be more useful in some use cases.### CSS - Cascading Style Sheets
A variation of the RGBA color model where the alpha/opacity is stored as a floating point number between 0.0 and 1.0.
This allows you to work with the colors using the `image/colors` package and convert it to this special color model that
can give you strings that specify the color according to CSS specifications. The `CSS` color model implements the
stringer interface.Examples:
- `rgb(255,191,128)`
- `rgba(255,191,128,0.75)`
- `#FFBF80`
- `#FFBF80BF`