- Notifications
You must be signed in to change notification settings - Fork0
Color format handling and translation library.
License
NotificationsYou must be signed in to change notification settings
Foxcapades/golour
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Go wrappers and converters for various color formats with no standard librarydependency (outside of unit tests).
Intended for use with alternative compilers such asTinyGofor use with JS/WASM build targets.
Currently, golour supports HSV/HSB, HSL, and RGB color formats and can translatebetween these types.
Each color type can additionally render itself in one or more JS/CSS friendlyformats, such as hex strings or CSS color functions.
RGB From Hex String
package mainimport ("fmt""github.com/foxcapades/golour/v1/pkg/colors")funcmain() {rgb:=colors.NewRGBFromHex("#FFEEDD")fmt.Println(rgb)// Outputs: rgba(255, 238, 221, 255)fmt.Println(rgb.HexRGB())// Outputs: #FFEEDDfmt.Println(rgb.CSSFuncRGB())// Outputs: rgb(255, 238, 221)fmt.Println(rgb.ToHSL())// Outputs: hsla(30, 100%, 93.3%, 1)}