Documentation
¶
Index ¶
- Constants
- Variables
- func CreatePalettes(config HuePalette) (lightPalettes []Palette, darkPalettes []Palette, err error)
- func MustCreatePalettes(config HuePalette) (lightPalettes []Palette, darkPalettes []Palette, err error)
- type AnyScaleDef
- type Color
- type ColorDirective
- type Curve
- type CurveFunc
- type CurveXYPoints
- type Directive
- type HuePalette
- type Number
- type NumberColor
- func (skv *NumberColor) Index(i int, v gocolorful.Color) *NumberColor
- func (skv *NumberColor) Key(k int, v gocolorful.Color) *NumberColor
- func (skv *NumberColor) KeyAtIndex(k int) string
- func (skv *NumberColor) ValueAtIndex(i int) gocolorful.Color
- func (skv *NumberColor) ValueAtKey(k int) gocolorful.Color
- type NumberFloat
- type NumberPalette
- type NumberScaleDef
- type NumberString
- type Palette
- type Palettes
- type ScaleDef
- type String
- type StringColor
- func (skv *StringColor) Index(i int, v gocolorful.Color) *StringColor
- func (skv *StringColor) Key(k string, v gocolorful.Color) *StringColor
- func (skv *StringColor) KeyAtIndex(k int) string
- func (skv *StringColor) ValueAtIndex(i int) gocolorful.Color
- func (skv *StringColor) ValueAtKey(k string) gocolorful.Color
- type StringFloat
- type StringNumber
- func (sv *StringNumber) GetScale() ScaleDef
- func (skv *StringNumber) Index(i int, v int) *StringNumber
- func (skv *StringNumber) Key(k string, v int) *StringNumber
- func (skv *StringNumber) KeyAtIndex(k int) string
- func (skv *StringNumber) ValueAtIndex(i int) int
- func (skv *StringNumber) ValueAtKey(k string) int
- type StringPalette
- type StringScaleDef
- type Stylus
- type StylusGroup
- type Theme
- type ThemeGenerator
- type ThemeResolver
- type ThemeResolvers
- type TypefaceDirective
- type URL
- type ValuesDef
- func (sv *ValuesDef) GetScale() ScaleDef
- func (sv *ValuesDef) Index(index int, value interface{}) *ValuesDef
- func (sv *ValuesDef) Key(key interface{}, value interface{}) *ValuesDef
- func (sv *ValuesDef) KeyAtIndex(index int) interface{}
- func (sv *ValuesDef) ValueAtIndex(index int) interface{}
- func (sv *ValuesDef) ValueAtKey(key interface{}) interface{}
- type XYCurve
Examples ¶
Constants ¶
const ( // These values are established by empiricism with // tests (tradeoff: performance VS precision) NEWTON_ITERATIONS = 4 NEWTON_MIN_SLOPE = 0.001 SUBDIVISION_PRECISION = 0.0000001 SUBDIVISION_MAX_ITERATIONS = float64(10) )
Variables ¶
var AmberPalette = MustUserPalettes(
"#fffbeb",
"#fef3c7",
"#fde68a",
"#fcd34d",
"#fbbf24",
"#f59e0b",
"#d97706",
"#b45309",
"#92400e",
"#78350f",
)
var BlueGrayPalette = MustUserPalettes(
"#f8fafc",
"#f1f5f9",
"#e2e8f0",
"#cbd5e1",
"#94a3b8",
"#64748b",
"#475569",
"#334155",
"#1e293b",
"#0f172a",
)
var BluePalette = MustUserPalettes(
"#eff6ff",
"#dbeafe",
"#bfdbfe",
"#93c5fd",
"#60a5fa",
"#3b82f6",
"#2563eb",
"#1d4ed8",
"#1e40af",
"#1e3a8a",
)
var CoolGrayPalette = MustUserPalettes(
"#f9fafb",
"#f3f4f6",
"#e5e7eb",
"#d1d5db",
"#9ca3af",
"#6b7280",
"#4b5563",
"#374151",
"#1f2937",
"#111827",
)
var CyanPalette = MustUserPalettes(
"#ecfeff",
"#cffafe",
"#a5f3fc",
"#67e8f9",
"#22d3ee",
"#06b6d4",
"#0891b2",
"#0e7490",
"#155e75",
"#164e63",
)
var DefaultColorScale = NumberScale(50, 100, 200, 300, 400, 500, 600, 700, 800, 900)
Colors represents measure/scale of possible color variants.
var EaseInBack = BezierXYPoints(0.6, -0.28, 0.735, 0.045)
var EaseInBackTCurve = BezierTPoints(0.6, -0.28, 0.735, 0.045)
var EaseInCirc = BezierXYPoints(0.6, 0.04, 0.98, 0.335)
var EaseInCircTCurve = BezierTPoints(0.6, 0.04, 0.98, 0.335)
var EaseInCubic = BezierXYPoints(0.55, 0.055, 0.675, 0.19)
var EaseInCubicTCurve = BezierTPoints(0.55, 0.055, 0.675, 0.19)
var EaseInExpo = BezierXYPoints(0.95, 0.05, 0.795, 0.035)
var EaseInExpoTCurve = BezierTPoints(0.95, 0.05, 0.795, 0.035)
var EaseInOutBack = BezierXYPoints(0.68, -0.55, 0.265, 1.55)
var EaseInOutBackTCurve = BezierTPoints(0.68, -0.55, 0.265, 1.55)
var EaseInOutCirc = BezierXYPoints(0.785, 0.135, 0.15, 0.86)
var EaseInOutCircTCurve = BezierTPoints(0.785, 0.135, 0.15, 0.86)
var EaseInOutCubic = BezierXYPoints(0.645, 0.045, 0.355, 1)
var EaseInOutCubicTCurve = BezierTPoints(0.645, 0.045, 0.355, 1)
var EaseInOutExpo = BezierXYPoints(1, 0, 0, 1)
var EaseInOutExpoTCurve = BezierTPoints(1, 0, 0, 1)
var EaseInOutQuad = BezierXYPoints(0.455, 0.03, 0.515, 0.955)
var EaseInOutQuadTCurve = BezierTPoints(0.455, 0.03, 0.515, 0.955)
var EaseInOutQuart = BezierXYPoints(0.77, 0, 0.175, 1)
var EaseInOutQuartTCurve = BezierTPoints(0.77, 0, 0.175, 1)
var EaseInOutQuint = BezierXYPoints(0.86, 0, 0.07, 1)
var EaseInOutQuintTCurve = BezierTPoints(0.86, 0, 0.07, 1)
var EaseInOutSine = BezierXYPoints(0.445, 0.05, 0.55, 0.95)
var EaseInOutSineTCurve = BezierTPoints(0.445, 0.05, 0.55, 0.95)
var EaseInQuad = BezierXYPoints(0.55, 0.085, 0.68, 0.53)
var EaseInQuadTCurve = BezierTPoints(0.55, 0.085, 0.68, 0.53)
var EaseInQuart = BezierXYPoints(0.895, 0.03, 0.685, 0.22)
var EaseInQuartTCurve = BezierTPoints(0.895, 0.03, 0.685, 0.22)
var EaseInQuint = BezierXYPoints(0.755, 0.05, 0.855, 0.06)
var EaseInQuintTCurve = BezierTPoints(0.755, 0.05, 0.855, 0.06)
var EaseInSine = BezierXYPoints(0.47, 0, 0.745, 0.715)
var EaseInSineTCurve = BezierTPoints(0.47, 0, 0.745, 0.715)
var EaseOutBack = BezierXYPoints(0.175, 0.885, 0.32, 1.275)
var EaseOutBackTCurve = BezierTPoints(0.175, 0.885, 0.32, 1.275)
var EaseOutCirc = BezierXYPoints(0.075, 0.82, 0.165, 1)
var EaseOutCircTCurve = BezierTPoints(0.075, 0.82, 0.165, 1)
var EaseOutCubic = BezierXYPoints(0.215, 0.61, 0.355, 1)
var EaseOutCubicTCurve = BezierTPoints(0.215, 0.61, 0.355, 1)
var EaseOutExpo = BezierXYPoints(0.19, 1, 0.22, 1)
var EaseOutExpoTCurve = BezierTPoints(0.19, 1, 0.22, 1)
var EaseOutQuad = BezierXYPoints(0.25, 0.46, 0.45, 0.94)
var EaseOutQuadTCurve = BezierTPoints(0.25, 0.46, 0.45, 0.94)
var EaseOutQuart = BezierXYPoints(0.165, 0.84, 0.44, 1)
var EaseOutQuartTCurve = BezierTPoints(0.165, 0.84, 0.44, 1)
var EaseOutQuint = BezierXYPoints(0.23, 1, 0.32, 1)
var EaseOutQuintTCurve = BezierTPoints(0.23, 1, 0.32, 1)
var EaseOutSine = BezierXYPoints(0.39, 0.575, 0.565, 1)
var EaseOutSineTCurve = BezierTPoints(0.39, 0.575, 0.565, 1)
var EmeraldPalette = MustUserPalettes(
"#ecfdf5",
"#d1fae5",
"#a7f3d0",
"#6ee7b7",
"#34d399",
"#10b981",
"#059669",
"#047857",
"#065f46",
"#064e3b",
)
var FuchsiaPalette = MustUserPalettes(
"#fdf4ff",
"#fae8ff",
"#f5d0fe",
"#f0abfc",
"#e879f9",
"#d946ef",
"#c026d3",
"#a21caf",
"#86198f",
"#701a75",
)
var GrayPalette = MustUserPalettes(
"#fafafa",
"#f4f4f5",
"#e4e4e7",
"#d4d4d8",
"#a1a1aa",
"#71717a",
"#52525b",
"#3f3f46",
"#27272a",
"#18181b",
)
var GreenPalette = MustUserPalettes(
"#f0fdf4",
"#dcfce7",
"#bbf7d0",
"#86efac",
"#4ade80",
"#22c55e",
"#16a34a",
"#15803d",
"#166534",
"#14532d",
)
var IndigoPalette = MustUserPalettes(
"#eef2ff",
"#e0e7ff",
"#c7d2fe",
"#a5b4fc",
"#818cf8",
"#6366f1",
"#4f46e5",
"#4338ca",
"#3730a3",
"#312e81",
)
var LightBluePalette = MustUserPalettes(
"#f0f9ff",
"#e0f2fe",
"#bae6fd",
"#7dd3fc",
"#38bdf8",
"#0ea5e9",
"#0284c7",
"#0369a1",
"#075985",
"#0c4a6e",
)
var LimePalette = MustUserPalettes(
"#f7fee7",
"#ecfccb",
"#d9f99d",
"#bef264",
"#a3e635",
"#84cc16",
"#65a30d",
"#4d7c0f",
"#3f6212",
"#365314",
)
var Linear = BezierXYPoints(0.5, 0.5, 0.5, 0.5)
var LinearTCurve = BezierTPoints(0.5, 0.5, 0.5, 0.5)
var OrangePalette = MustUserPalettes(
"#fff7ed",
"#ffedd5",
"#fed7aa",
"#fdba74",
"#fb923c",
"#f97316",
"#ea580c",
"#c2410c",
"#9a3412",
"#7c2d12",
)
var PinkPalette = MustUserPalettes(
"#fdf2f8",
"#fce7f3",
"#fbcfe8",
"#f9a8d4",
"#f472b6",
"#ec4899",
"#db2777",
"#be185d",
"#9d174d",
"#831843",
)
var PurplePalette = MustUserPalettes(
"#faf5ff",
"#f3e8ff",
"#e9d5ff",
"#d8b4fe",
"#c084fc",
"#a855f7",
"#9333ea",
"#7e22ce",
"#6b21a8",
"#581c87",
)
var RedPalette = MustUserPalettes(
"#fef2f2",
"#fee2e2",
"#fecaca",
"#fca5a5",
"#f87171",
"#ef4444",
"#dc2626",
"#b91c1c",
"#991b1b",
"#7f1d1d",
)
var RosePalette = MustUserPalettes(
"#fff1f2",
"#ffe4e6",
"#fecdd3",
"#fda4af",
"#fb7185",
"#f43f5e",
"#e11d48",
"#be123c",
"#9f1239",
"#881337",
)
var TealPalette = MustUserPalettes(
"#f0fdfa",
"#ccfbf1",
"#99f6e4",
"#5eead4",
"#2dd4bf",
"#14b8a6",
"#0d9488",
"#0f766e",
"#115e59",
"#134e4a",
)
var TrueGrayPalette = MustUserPalettes(
"#fafafa",
"#f5f5f5",
"#e5e5e5",
"#d4d4d4",
"#a3a3a3",
"#737373",
"#525252",
"#404040",
"#262626",
"#171717",
)
var VioletPalette = MustUserPalettes(
"#f5f3ff",
"#ede9fe",
"#ddd6fe",
"#c4b5fd",
"#a78bfa",
"#8b5cf6",
"#7c3aed",
"#6d28d9",
"#5b21b6",
"#4c1d95",
)
var WarmGrayPalette = MustUserPalettes(
"#fafaf9",
"#f5f5f4",
"#e7e5e4",
"#d6d3d1",
"#a8a29e",
"#78716c",
"#57534e",
"#44403c",
"#292524",
"#1c1917",
)
var YellowPalette = MustUserPalettes(
"#fefce8",
"#fef9c3",
"#fef08a",
"#fde047",
"#facc15",
"#eab308",
"#ca8a04",
"#a16207",
"#854d0e",
"#713f12",
)
Functions ¶
func CreatePalettes ¶
func CreatePalettes(config HuePalette) (lightPalettes []Palette, darkPalettes []Palette, err error)
func MustCreatePalettes ¶
func MustCreatePalettes(config HuePalette) (lightPalettes []Palette, darkPalettes []Palette, err error)
Types ¶
type AnyScaleDef ¶
type AnyScaleDef struct {
// contains filtered or unexported fields
}
func AnyScale ¶
func AnyScale(values ...interface{}) *AnyScaleDef
func (*AnyScaleDef) Count ¶
func (s *AnyScaleDef) Count() int
func (*AnyScaleDef) HasIndex ¶
func (s *AnyScaleDef) HasIndex(i int) bool
func (*AnyScaleDef) Index ¶
func (s *AnyScaleDef) Index(i int) interface{}
func (*AnyScaleDef) IsKeyType ¶
func (s *AnyScaleDef) IsKeyType(i interface{}) bool
IsKeyType always returns true for AnyScaleDef.
func (*AnyScaleDef) Key ¶
func (s *AnyScaleDef) Key(i interface{}) bool
type ColorDirective ¶
type ColorDirective struct { Light *NumberPalette Dark *NumberPalette }
type Curve ¶
func BezierTPoints ¶
type CurveXYPoints ¶
func BezierXYPointsList ¶
func BezierXYPointsList(points ...float64) CurveXYPoints
type Directive ¶
type Directive struct { Screens map[string]bool // screen variant Variants []string // other variants Style string // the target style e.g text-gray-500, font-thin, ...etc Negated bool // has a ! at the end of the style to negate giving styling. Dark bool }
func ParseDirective ¶
ParseDirective parses incoming directive string, which we follow a simple format:
- If directive has one or multiple `text:` parts then this is sorted as variants on the giving directive. e.g sm: for (small screens size), hover: for hover state, ..etc e.g sm:hover:text-red-500
- if a directive has a `1` at the end then we enable negation on directive. e.g font-8 font-8! where font-8! => resets the font size to `inherit`
type HuePalette ¶
type HuePalette struct { Steps int // number of colors to be generated HueStart int // Hue value (0-360) HueEnd int // Hue value (0-360) HueCurve Curve // Hue bezier curve points SaturationRate float64 // rate of saturation increase (0-200) SaturationStart int // Saturation value (0-100) SaturationEnd int // Saturation value (0-100) SaturationCurve Curve // Bezier curve points for saturation LuminousityStart int // Luminous value (0-100) LuminousityEnd int // Luminous value (0-100) LuminosityCurve Curve // Luminosity bezier curve points ContrastColorLight gocolorful.Color // Provides light color contrast to be used for calculating contrast ContrastColorDark gocolorful.Color // Provides dark color contrast to be used for calculating contrast }
HuePalette implements the color algorithm defined in the lyft color algorithm which provides a more concise way of generating colors for specific hues, saturation and luminousity levels that match how we perceive colors.
See - [Re-Approaching Color by Lyft Design](https://design.lyft.com/re-approaching-color-9e604ba22c88) and [Life Color Algorithm](https://github.com/lyft/coloralgorithm).
func Hex ¶
func Hex(hex string) (HuePalette, error)
type Number ¶
type Number struct {
Scale *ValuesDef
}
func (*Number) KeyAtIndex ¶
func (*Number) ValueAtIndex ¶
func (*Number) ValueAtKey ¶
type NumberColor ¶
type NumberColor struct {
Scale *ValuesDef
}
func NewNumberColor ¶
func NewNumberColor(scale ScaleDef) *NumberColor
func (*NumberColor) Index ¶
func (skv *NumberColor) Index(i int, v gocolorful.Color) *NumberColor
func (*NumberColor) Key ¶
func (skv *NumberColor) Key(k int, v gocolorful.Color) *NumberColor
func (*NumberColor) KeyAtIndex ¶
func (skv *NumberColor) KeyAtIndex(k int) string
func (*NumberColor) ValueAtIndex ¶
func (skv *NumberColor) ValueAtIndex(i int) gocolorful.Color
func (*NumberColor) ValueAtKey ¶
func (skv *NumberColor) ValueAtKey(k int) gocolorful.Color
type NumberFloat ¶
type NumberFloat struct {
Scale *ValuesDef
}
func NewNumberFloat ¶
func NewNumberFloat(scale ScaleDef) *NumberFloat
func (*NumberFloat) Index ¶
func (skv *NumberFloat) Index(i int, v float64) *NumberFloat
func (*NumberFloat) Key ¶
func (skv *NumberFloat) Key(k int, v float64) *NumberFloat
func (*NumberFloat) KeyAtIndex ¶
func (skv *NumberFloat) KeyAtIndex(k int) string
func (*NumberFloat) ValueAtIndex ¶
func (skv *NumberFloat) ValueAtIndex(i int) float64
func (*NumberFloat) ValueAtKey ¶
func (skv *NumberFloat) ValueAtKey(k int) float64
type NumberPalette ¶
type NumberPalette struct {
Scale *ValuesDef
}
func ColorFromDefaultScale ¶
func ColorFromDefaultScale(values ...Palette) *NumberPalette
func NewNumberPalette ¶
func NewNumberPalette(scale ScaleDef) *NumberPalette
func (*NumberPalette) Index ¶
func (skv *NumberPalette) Index(i int, v Palette) *NumberPalette
func (*NumberPalette) Key ¶
func (skv *NumberPalette) Key(k int, v Palette) *NumberPalette
func (*NumberPalette) KeyAtIndex ¶
func (skv *NumberPalette) KeyAtIndex(k int) string
func (*NumberPalette) ValueAtIndex ¶
func (skv *NumberPalette) ValueAtIndex(i int) Palette
func (*NumberPalette) ValueAtKey ¶
func (skv *NumberPalette) ValueAtKey(k int) Palette
type NumberScaleDef ¶
type NumberScaleDef struct {
// contains filtered or unexported fields
}
func NumberScale ¶
func NumberScale(values ...int) *NumberScaleDef
func (*NumberScaleDef) Count ¶
func (s *NumberScaleDef) Count() int
func (*NumberScaleDef) HasIndex ¶
func (s *NumberScaleDef) HasIndex(i int) bool
func (*NumberScaleDef) Index ¶
func (s *NumberScaleDef) Index(i int) interface{}
func (*NumberScaleDef) IsKeyType ¶
func (s *NumberScaleDef) IsKeyType(i interface{}) bool
func (*NumberScaleDef) Key ¶
func (s *NumberScaleDef) Key(i interface{}) bool
type NumberString ¶
type NumberString struct {
Scale *ValuesDef
}
func NewNumberString ¶
func NewNumberString(scale ScaleDef) *NumberString
func (*NumberString) Index ¶
func (skv *NumberString) Index(i int, v string) *NumberString
func (*NumberString) Key ¶
func (skv *NumberString) Key(k int, v string) *NumberString
func (*NumberString) KeyAtIndex ¶
func (skv *NumberString) KeyAtIndex(k int) string
func (*NumberString) ValueAtIndex ¶
func (skv *NumberString) ValueAtIndex(i int) string
func (*NumberString) ValueAtKey ¶
func (skv *NumberString) ValueAtKey(k int) string
type Palette ¶
type Palette struct { Step int Steps int Hex string RGB gocolorful.Color HCL gocolorful.Color HSV gocolorful.Color HSL gocolorful.Color ContrastDark float64 ContrastLight float64 HueRange []int Hue float64 Saturation float64 Luminosity float64 }
Palette defines the generated color set which is produced from provided HuePalette.
Example ¶
var light, dark, perr = CreatePalettes(HuePalette{ Steps: 10, HueStart: 100, HueEnd: 359, HueCurve: EaseInCubicTCurve, SaturationRate: 30, SaturationStart: 10, SaturationEnd: 80, SaturationCurve: EaseInCubicTCurve, LuminousityStart: 5, LuminousityEnd: 80, LuminosityCurve: EaseInCubicTCurve, }) if perr != nil { log.Fatalf("Error: %s\n", perr) } var lightJSON, err = json.Marshal(light) if err != nil { log.Fatal(err.Error()) } fmt.Println(lightJSON) var darkJSON, err2 = json.Marshal(dark) if err2 != nil { log.Fatal(err2.Error()) } fmt.Println(darkJSON)
Output:
func MustUserPalettes ¶
func UserPalettes ¶
type String ¶
type String struct {
Scale *ValuesDef
}
func (*String) KeyAtIndex ¶
KeyAtIndex uses zero-index based values.
func (*String) ValueAtIndex ¶
ValueAtIndex uses zero-index based values.
func (*String) ValueAtKey ¶
type StringColor ¶
type StringColor struct {
Scale *ValuesDef
}
func NewStringColor ¶
func NewStringColor(scale ScaleDef) *StringColor
func (*StringColor) Index ¶
func (skv *StringColor) Index(i int, v gocolorful.Color) *StringColor
func (*StringColor) Key ¶
func (skv *StringColor) Key(k string, v gocolorful.Color) *StringColor
func (*StringColor) KeyAtIndex ¶
func (skv *StringColor) KeyAtIndex(k int) string
func (*StringColor) ValueAtIndex ¶
func (skv *StringColor) ValueAtIndex(i int) gocolorful.Color
func (*StringColor) ValueAtKey ¶
func (skv *StringColor) ValueAtKey(k string) gocolorful.Color
type StringFloat ¶
type StringFloat struct {
Scale *ValuesDef
}
func NewStringFloat ¶
func NewStringFloat(scale ScaleDef) *StringFloat
func (*StringFloat) Index ¶
func (skv *StringFloat) Index(i int, v float64) *StringFloat
func (*StringFloat) Key ¶
func (skv *StringFloat) Key(k string, v float64) *StringFloat
func (*StringFloat) KeyAtIndex ¶
func (skv *StringFloat) KeyAtIndex(k int) string
func (*StringFloat) ValueAtIndex ¶
func (skv *StringFloat) ValueAtIndex(i int) float64
func (*StringFloat) ValueAtKey ¶
func (skv *StringFloat) ValueAtKey(k string) float64
type StringNumber ¶
type StringNumber struct {
Scale *ValuesDef
}
func NewStringNumber ¶
func NewStringNumber(scale ScaleDef) *StringNumber
func (*StringNumber) GetScale ¶
func (sv *StringNumber) GetScale() ScaleDef
func (*StringNumber) Index ¶
func (skv *StringNumber) Index(i int, v int) *StringNumber
func (*StringNumber) Key ¶
func (skv *StringNumber) Key(k string, v int) *StringNumber
func (*StringNumber) KeyAtIndex ¶
func (skv *StringNumber) KeyAtIndex(k int) string
func (*StringNumber) ValueAtIndex ¶
func (skv *StringNumber) ValueAtIndex(i int) int
func (*StringNumber) ValueAtKey ¶
func (skv *StringNumber) ValueAtKey(k string) int
type StringPalette ¶
type StringPalette struct {
Scale *ValuesDef
}
func NewStringPalette ¶
func NewStringPalette(scale ScaleDef) *StringPalette
func (*StringPalette) Index ¶
func (skv *StringPalette) Index(i int, v Palette) *StringPalette
func (*StringPalette) Key ¶
func (skv *StringPalette) Key(k string, v Palette) *StringPalette
func (*StringPalette) KeyAtIndex ¶
func (skv *StringPalette) KeyAtIndex(k int) string
func (*StringPalette) ValueAtIndex ¶
func (skv *StringPalette) ValueAtIndex(i int) Palette
func (*StringPalette) ValueAtKey ¶
func (skv *StringPalette) ValueAtKey(k string) Palette
type StringScaleDef ¶
type StringScaleDef struct {
// contains filtered or unexported fields
}
func StringScale ¶
func StringScale(values ...string) *StringScaleDef
func (*StringScaleDef) Count ¶
func (s *StringScaleDef) Count() int
func (*StringScaleDef) HasIndex ¶
func (s *StringScaleDef) HasIndex(i int) bool
func (*StringScaleDef) Index ¶
func (s *StringScaleDef) Index(i int) interface{}
func (*StringScaleDef) IsKeyType ¶
func (s *StringScaleDef) IsKeyType(i interface{}) bool
func (*StringScaleDef) Key ¶
func (s *StringScaleDef) Key(i interface{}) bool
type StylusGroup ¶
func NewStylusGroup ¶
func NewStylusGroup() StylusGroup
func (StylusGroup) Add ¶
func (st StylusGroup) Add(name string, sl Stylus)
func (StylusGroup) GetOrAdd ¶
func (st StylusGroup) GetOrAdd(name string) *Stylus
type Theme ¶
type Theme struct { Resolvers ThemeGenerator Screens *String Colors map[string]*ColorDirective }
* Theme provides a clear description of a predefined styling which will be used to generate unique styles for each target element. It provides fields to cover the following styling.
Main Styles
func (*Theme) MustResolve ¶
func (t *Theme) MustResolve(directive *domu.ThemeDirective, root *domu.Node)
type ThemeGenerator ¶
type ThemeResolver ¶
type ThemeResolver interface { Can(directive Directive, variant string) bool Resolve(theme *Theme, directive Directive, variant string, targetSelector string) (string, Stylus) }
ThemeResolver are implementations which exists to handle specific forms of styling based on the Directive and variant supplied.
Each can indicate if it can handle such a directive and variant and if so, will return the group of css properties (key:value pairs) and the full name for the giving style.
Please ensure to take into account the exact css style name as the selector of the target node is supplied and it's the responsibility of the resolver to return what should be the css property selector for it's generated styles.
type ThemeResolvers ¶
type ThemeResolvers []ThemeResolver
func (*ThemeResolvers) Add ¶
func (t *ThemeResolvers) Add(r ThemeResolver)
func (ThemeResolvers) Generate ¶
func (t ThemeResolvers) Generate(themeDirective *domu.ThemeDirective, theme *Theme, root *domu.Node) error
type TypefaceDirective ¶
type URL ¶
type URL string
URL represent a style url, image unit type in css (used by background-image, etc).
type ValuesDef ¶
type ValuesDef struct {
// contains filtered or unexported fields
}
func NewValuesDef ¶
func (*ValuesDef) KeyAtIndex ¶
func (*ValuesDef) ValueAtIndex ¶
func (*ValuesDef) ValueAtKey ¶
func (sv *ValuesDef) ValueAtKey(key interface{}) interface{}