Copyright | (c) 2017 Cristian Adrián Ontivero |
---|---|
License | BSD3 |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
CSS Numeric data types: <number>, <percentage>, and <alphavalue>. All Rational newtypes to ensure dimension conversion precision.
Synopsis
- newtype Percentage = Percentage Rational
- toPercentage :: Real a => a -> Percentage
- newtype Number = Number {}
- toNumber :: Real a => a -> Number
- fromNumber :: Fractional a => Number -> a
- newtype Alphavalue = Alphavalue Rational
- toAlphavalue :: Real a => a -> Alphavalue
- mkAlphavalue :: Rational -> Alphavalue
Documentation
newtype Percentage Source #
The <percentage> data type. Many CSS properties can take percentage
values, often to define sizes in terms of parent objects. Percentages are
formed by a <number> immediately followed by the percentage sign %.
There is no space between the %
and the number. Specification:
- <https://drafts.csswg.org/css-values-3/#percentages CSS Value and Units Module Level 3 (§4.3)
- <https://www.w3.org/TR/CSS2/syndata.html#percentage-units CSS2.1 (§4.3.3)
- <https://www.w3.org/TR/CSS1/#percentage-units CSS1 (§6.2)
Instances
toPercentage :: Real a => a -> Percentage Source #
The <number> data type. Real numbers, possibly with a fractional component. When written literally, a number is either an integer, or zero or more decimal digits followed by a dot (.) followed by one or more decimal digits and optionally an exponent composed of "e" or E and an integer. It corresponds to the <number-token> production in the CSS Syntax Module [CSS3SYN]. As with integers, the first character of a number may be immediately preceded by - or + to indicate the number’s sign. Specifications:
fromNumber :: Fractional a => Number -> a Source #
newtype Alphavalue Source #
The <alphavalue> data type. Syntactically a <number>. It is the uniform opacity setting to be applied across an entire object. Any values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) are clamped to this range. Specification:
- <https://www.w3.org/TR/css3-color/#transparency CSS Color Module Level 3 (§3.2)
Instances
toAlphavalue :: Real a => a -> Alphavalue Source #
mkAlphavalue :: Rational -> Alphavalue Source #