486 Commits

Author SHA1 Message Date
ConnorSkees
a328617001 Implement builtin function change-color() 2020-02-14 17:38:10 -05:00
ConnorSkees
af95658953 Implement builtin function mix() 2020-02-14 16:56:23 -05:00
ConnorSkees
c04f83ddcf Refactor Color functions into multiple impl blocks 2020-02-14 15:22:39 -05:00
ConnorSkees
8f63694ffd Refactor color functions into separate modules 2020-02-14 15:08:41 -05:00
ConnorSkees
dafd1f3e0d Refactor internal printing of StyleSheet 2020-02-14 14:55:21 -05:00
ConnorSkees
f6f4eb3e15 Cleanup example code for StyleSheet::print_as_css() 2020-02-14 14:36:16 -05:00
ConnorSkees
6c97cd4755 Implement builtin function str-slice() 2020-02-14 14:23:54 -05:00
ConnorSkees
c95ecc0825 Fix crash encountering -- 2020-02-14 13:27:08 -05:00
ConnorSkees
3af2292d5b Implement builtin function complement() 2020-02-14 12:56:28 -05:00
ConnorSkees
7f17139a3b Refactor HSL functions into separate module 2020-02-14 12:43:12 -05:00
ConnorSkees
f7351e1458 Implement builtin function abs() 2020-02-14 12:30:48 -05:00
ConnorSkees
af8bd516b2 Implement builtin function grayscale() 2020-02-14 12:11:08 -05:00
ConnorSkees
08bfa8f145 Implement one and two args for rgba() 2020-02-14 11:52:31 -05:00
ConnorSkees
a2ddc8016f Implement builtin functions fade-in(), fade-out(), opacify(), and transparentize() 2020-02-14 11:10:25 -05:00
ConnorSkees
089436ec9d Revert "Allow unquote on all values"
This reverts commit f4c5fbae274ddd545d34107e424fa3b9c842ea14.

This change resulted in nine regressions in the spec tests. This is a
change that we should make later when the `unquote()` function has the
correct functionality. For right now, the implementation of `unquote()` is a hack to just get
things working.
2020-02-14 10:23:43 -05:00
ConnorSkees
a7322e1ee8 Allow numbers in selectors 2020-02-14 10:16:26 -05:00
ConnorSkees
f4c5fbae27 Allow unquote on all values 2020-02-14 10:11:26 -05:00
ConnorSkees
b31c9587bc Implement builtin function length() 2020-02-14 10:10:51 -05:00
ConnorSkees
38802b69c5 Fix hue algorithm when red == blue and red > green 2020-02-14 09:46:50 -05:00
ConnorSkees
65c5c209f3 Implement Rem and RemAssign for Number 2020-02-14 09:44:46 -05:00
ConnorSkees
201f97a914 Fix how hue is calculated when color channels are equal 2020-02-14 09:37:05 -05:00
ConnorSkees
be84350d19 Implement builtin functions saturate() and desaturate() 2020-02-14 09:05:57 -05:00
ConnorSkees
c7c1ad5fe5 Implement builtin function darken() 2020-02-14 08:54:43 -05:00
ConnorSkees
db8e8eaebb Implement builtin function lighten() 2020-02-14 08:43:10 -05:00
ConnorSkees
6427a7ab81 Implement builtin function adjust-hue 2020-02-14 08:15:19 -05:00
ConnorSkees
f8a09bec6e Initial implementation of Div for Value::Dimension 2020-02-14 08:15:19 -05:00
ConnorSkees
496c0740f2 Remove redundant clone before Value::eval() 2020-02-14 07:51:36 -05:00
ConnorSkees
4c70b84ed7 Calls to undefined functions should be treated as idents 2020-02-09 20:26:14 -05:00
ConnorSkees
e37179cfd7 Properly handle precision 2020-02-09 20:00:35 -05:00
ConnorSkees
589ebce452 Allow for unknown at-rules 2020-02-09 19:44:45 -05:00
ConnorSkees
7fcfeee97e clippy 2020-02-09 19:07:44 -05:00
ConnorSkees
f6b27177ba Use Number as to represent color channels so precision is not lost 2020-02-09 18:53:48 -05:00
ConnorSkees
0ec2c46744 rustfmt 2020-02-09 18:28:24 -05:00
ConnorSkees
40e1e554c7 Implement builtin functions ceil() and floor() 2020-02-09 16:14:24 -05:00
ConnorSkees
116bb43bd5 Implement builtin function round() 2020-02-09 16:10:32 -05:00
ConnorSkees
405a1c2d42 Implement mul and div for Value and builtin function percentage() 2020-02-09 16:05:07 -05:00
ConnorSkees
c7f1941823 Boilerplate for builtin function call() 2020-02-09 15:36:30 -05:00
ConnorSkees
b8d8824db9 Lex and parse negative numbers 2020-02-09 15:08:33 -05:00
ConnorSkees
2f54de15c5 Allow optional alpha argument in rgb() 2020-02-09 15:07:29 -05:00
ConnorSkees
d6ed0391db Handle function calls in call args 2020-02-09 14:27:54 -05:00
ConnorSkees
bc0c1d35f6 Clamp values passed to from_hsla() 2020-02-09 14:24:27 -05:00
ConnorSkees
d14ac11396 Implement weight for invert() 2020-02-09 13:44:27 -05:00
ConnorSkees
1269c9f662 Initial implementation of invert() (no support for weight argument) 2020-02-09 13:31:58 -05:00
ConnorSkees
8638e2f251 Implement builtin functions hue(), saturation(), and lightness() 2020-02-09 12:18:41 -05:00
ConnorSkees
835fe61bb4 Implement subtraction for colors 2020-02-09 11:07:13 -05:00
ConnorSkees
e282220f8c Refactor how color repr is created 2020-02-09 10:56:45 -05:00
ConnorSkees
2b3d8fcce7 Implement addition between colors and idents 2020-02-09 10:49:37 -05:00
ConnorSkees
901c911b5b Handle percentages and large/small values inside rgb() and rgba() 2020-02-09 10:41:05 -05:00
ConnorSkees
3d0d37bf2d Convert colors resulting from functions to named colors when applicable 2020-02-09 03:43:46 -05:00
ConnorSkees
f3e0638329 Allow hue to be in degrees 2020-02-09 03:21:15 -05:00