csshelpers

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2023 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

View Source
const (
	COLOR_BLACK      = "#000000" // Black
	COLOR_GREY       = "#575757" // Grey
	COLOR_DARK_GRAY  = "#252525" // Dark Grey
	COLOR_LIGHT_GRAY = "#9d9d9d" // Light Grey
	COLOR_RED        = "#ff0000" // Red
	COLOR_GREEN      = "#00ff00" // Green
	COLOR_BLUE       = "#0000ff" // Blue
	COLOR_YELLOW     = "#ffff00" // Yellow
	COLOR_PURPLE     = "#ff00ff" // Purple
	COLOR_CYAN       = "#00ffff" // Cyan
	COLOR_ORANGE     = "#ffa500" // Orange
	COLOR_BROWN      = "#a52a2a" // Brown
	COLOR_PINK       = "#ffc0cb" // Pink
	COLOR_WHITE      = "#ffffff" // White
	COLOR_LIME       = "#00ff00" // Lime
	COLOR_MAROON     = "#800000" // Maroon
	COLOR_NAVY       = "#000080" // Navy
	COLOR_OLIVE      = "#808000" // Olive
	COLOR_TEAL       = "#008080" // Teal
	COLOR_AQUA       = "#00ffff" // Aqua
	COLOR_FUCHSIA    = "#ff00ff" // Fuchsia
	COLOR_SILVER     = "#c0c0c0" // Silver
)

Predefined colors

Variables

View Source
var (
	COLOR_MAIN        = "white"           // Main color - white
	COLOR_ONE         = "#222e50"         // COLOR_ONE - dark blue
	COLOR_ONE_LIGHTER = "#334679"         // COLOR_ONE_LIGHTER - lighter dark blue
	COLOR_TWO         = "#e9d985"         // COLOR_TWO - yellow
	COLOR_THREE       = "#439a86"         // COLOR_THREE - green
	COLOR_FOUR        = "#DADFF7"         // COLOR_FOUR - light blue
	COLOR_FIVE        = "#007991"         // COLOR_FIVE - dark green
	COLOR_SIX         = "#ff0057"         // COLOR_SIX - red
	BACKGROUND_COLOR  = "rgba(0,0,0,0.5)" // Background color (for modals, etc.)
)

General colors for use in CSS. Can be overridden.

Functions

func Complementary

func Complementary(col string) (string, error)

Get the complementary color of a string.

func FormatRGBA

func FormatRGBA(color, format string) string

If the right format is not given, we will return the color as is.

func SeenColor

func SeenColor(col Color) string

func ToPX

func ToPX(px int) string

Convert an interger to the appropriate CSS PX value.

func ToPercent

func ToPercent(percent int) string

Convert an interger to the appropriate CSS EM value.

func ToRem

func ToRem(rem int) string

Convert an interger to the appropriate CSS REM value.

func ToVH

func ToVH(vh int) string

Convert an interger to the appropriate CSS VH value.

func ToVW

func ToVW(vw int) string

Convert an interger to the appropriate CSS VW value.

Types

type Color

type Color struct {
	R float64
	G float64
	B float64
}

https://github.com/lucasb-eyer/go-colorful

func Hex

func Hex(scol string) (Color, error)

https://github.com/lucasb-eyer/go-colorful Hex parses a "html" hex color-string, either in the 3 "#f0c" or 6 "#ff1034" digits form. It also parses the named colors from the CSS3 specification.

func Hsv

func Hsv(H, S, V float64) Color

https://github.com/lucasb-eyer/go-colorful Hsv creates a new Color given a Hue in [0..360], a Saturation and a Value in [0..1]

func HueOffset

func HueOffset(col Color, degrees int) Color

https://github.com/muesli/gamut

func RGB255

func RGB255(r, g, b uint8) Color

Convert RGB values to a Color struct.

func UnsafeHex

func UnsafeHex(scol string) Color

!WARNING! Only use this if you are sure the color is valid.

func (*Color) Complementary

func (col *Color) Complementary() Color

Get the complementary color struct.

func (Color) Hex

func (col Color) Hex() string

https://github.com/lucasb-eyer/go-colorful Hex returns the hex "html" representation of the color, as in #ff0080.

func (Color) Hsv

func (col Color) Hsv() (h, s, v float64)

https://github.com/lucasb-eyer/go-colorful

func (Color) RGB255

func (col Color) RGB255() (r, g, b uint8)

https://github.com/lucasb-eyer/go-colorful Might come in handy sometimes to reduce boilerplate code.

func (Color) RGBA

func (col Color) RGBA() (r, g, b, a uint32)

https://github.com/lucasb-eyer/go-colorful Implement the Go color.Color interface.

func (*Color) Triadic

func (c *Color) Triadic() []Color

Triadic returns the triadic values for any given color

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL