Documentation
¶
Overview ¶
Package css reads the declarations of an inline style attribute that say how content is displayed: display, visibility, opacity, the alpha of the text colour, and white-space. Nothing is measured or compared: colours are read only for whether they are fully transparent. Stylesheets are not read.
Index ¶
Constants ¶
const MaxLen = 16 << 10
MaxLen bounds the length of a style attribute that is read; the rest is ignored.
Variables ¶
This section is empty.
Functions ¶
func Alpha ¶
Alpha returns the alpha, from 0 to 1, of a CSS colour value, and false when the value is not a colour this reads (a keyword that inherits, color-mix(), a malformed value). "transparent" is 0; a named colour 1; #rgba and #rrggbbaa carry their alpha; a colour function its "/ alpha" or fourth argument.
Types ¶
type Style ¶
type Style struct {
Display string // lowercased keyword
Visibility string
// Opacity, clamped to 0..1 as CSS clamps it.
Opacity float64
OpacitySet bool
// ColorAlpha is the alpha of the declared text colour, 0 for
// transparent. ColorSet is false when no colour is declared, or the
// value inherits (inherit, unset, currentcolor) or is not a colour.
ColorAlpha float64
ColorSet bool
WhiteSpace string
}
Style holds what an inline style declares. A field is its zero value when the property is not declared.