styleguide

package
v0.0.0-...-0532aa7 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnimationCurveFastOutSlowIn   = "cubic-bezier(0.4, 0, 0.2, 1)"
	AnimationCurveLinearOutSlowIn = "cubic-bezier(0, 0, 0.2, 1)"
	AnimationCurveFastOutLinearIn = "cubic-bezier(0.4, 0, 1, 1)"
	AnimationCurveDefault         = AnimationCurveFastOutSlowIn

	AugmentedFourth = 1.414
	MinorSecond     = 1.067
	MajorSecond     = 1.125
	MinorThird      = 1.200
	MajorThird      = 1.250
	PerfectFourth   = 1.333
	PerfectFifth    = 1.500
	GoldenRatio     = 1.618

	LuminFlat     = 1.015
	LuminFat      = 1.200
	LuminFatThird = 1.245
)

contains different constants used within the package.

Variables

View Source
var (
	// MaterialPalettes provides material-design chosen color palettes
	// converted from the material-design spec.
	MaterialPalettes = map[string][]string{}
)

Functions

func GenerateValueScale

func GenerateValueScale(base float64, scale float64, minorCount int, majorCount int) ([]float64, []float64)

GenerateValueScale returns a slice of values which are the a combination of a reducing + increasing scaled values of the provided scale generated from using the base initial 1.0 value against an ever incremental 1.0*(scale * n) or 1.0 / (scale *n) value, where n is the ever increasing index.

func Render

func Render(w io.Writer, attr common.Theme) error

Render initializes the style guide and all internal properties into appropriate defaults and states and generates a css style written into the provided writer

Types

type Color

type Color struct {
	C          colorful.Color
	Hue        float64 `json:"hue"`
	Luminosity float64 `json:"luminosity"`
	Saturation float64 `json:"saturation"`
	Alpha      float64 `json:"alpha"`
}

Color defines a basic struct which expresses the color values provided a struct containing HSL points.

func AdditiveLumination

func AdditiveLumination(c Color, scale float64) Color

AdditiveLumination adds the provided scale to the colors Luminouse value returning a new color suited to match.

func AdditiveSaturation

func AdditiveSaturation(c Color, scale float64) Color

AdditiveSaturation adds the provided scale to the colors saturation value returning a new color suited to match.

func ColorFrom

func ColorFrom(value string) (Color, error)

ColorFrom returns a Color instance representing the valid color values provided else returning error if the color value is not a valid color presentation i.e (rgb,rgba, hsl, hex).

func MultiplicativeLumination

func MultiplicativeLumination(c Color, scale float64) Color

MultiplicativeLumination multiples the scale to the colors Luminouse value using the returned value as addition to the current Luminouse value. Creating a gradual change in luminousity for the returned color.

func MultiplicativeSaturation

func MultiplicativeSaturation(c Color, scale float64) Color

MultiplicativeSaturation multiples the scale to the colors saturation value using the returned value as a addition to the current saturation value, Creating a gradual change in saturation for the returned color.

func (Color) String

func (c Color) String() string

String returns the Hex representation of the color.

type Tones

type Tones struct {
	Base   Color   `json:"base"`
	Grades []Color `json:"tones"`
}

Tones defines the set of color tones generated for a base color using the Hamonic tone sets, it provides a very easily set of color variations for use in styles.

func HamonicsFrom

func HamonicsFrom(c Color) Tones

HamonicsFrom uses the above scale to return a slice of new Colors based on the provided HamonyScale set.

func NewTones

func NewTones(base string) (Tones, error)

NewTones returns a new Tones object representing the provided color tones if the value provided is a valid color.

func (Tones) String

func (t Tones) String() string

String returns the string representation of the provided tone.

Jump to

Keyboard shortcuts

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