65 Commits

Author SHA1 Message Date
ConnorSkees
6d76e1518a refactor away many unwraps 2020-05-25 00:57:59 -04:00
ConnorSkees
bb89a865d4 remove clones when paring hsla colors 2020-05-24 07:42:42 -04:00
ConnorSkees
969726eb30 Revert string interning
There existed issues related to multithreaded tests that are difficult
to resolve. In the future interning may be reimplemented but in a more
limited capacity.

The motivation behind interning *values* was that it appeared checking
for named colors was responsible for much of the time lost when parsing
unquoted strings. If interning were to be reimplemented, it may make
sense to limit it solely to identifiers and style properties.
2020-05-22 14:20:31 -04:00
ConnorSkees
9a6c8ce019 add string interning
this seems to improve performance by ~20% as well as significantly
decrease memory usage
2020-05-21 22:46:40 -04:00
ConnorSkees
dc5df157b0 replace macro with fn 2020-05-20 23:56:17 -04:00
ConnorSkees
45a29c9697 refactor Number::to_integer 2020-05-20 22:40:21 -04:00
ConnorSkees
bea90060a8 minor cleanup 2020-05-20 00:14:55 -04:00
ConnorSkees
8520048b26 implement small int optimizations
This allows for numbers within 18 digits of precision (the vast
majority of numbers) to be represented by just 2 i64s rather than 2 heap
allocated BigInts. In the future these optimizations may become more
aggressive and granular, but for now `grass` is already more than an order of
magnitude faster than `dart-sass`.
2020-05-19 23:23:04 -04:00
ConnorSkees
cf987abb53 remove bimap in favor of ad hoc structure 2020-05-19 19:13:49 -04:00
ConnorSkees
d4f67b5ed9 clippy 2020-05-16 18:38:37 -04:00
ConnorSkees
a6e03e4ae1 reduce nesting in ident parsing 2020-04-30 16:02:40 -04:00
ConnorSkees
bc09e49c89 remove is_float field of ParsedNumber 2020-04-28 15:28:50 -04:00
ConnorSkees
bcbf3f4a90 clippy 2020-04-28 15:14:44 -04:00
ConnorSkees
269f37034a clippy 2020-04-28 08:27:35 -04:00
ConnorSkees
f158f03708 better handle named color transparent 2020-04-26 22:51:38 -04:00
ConnorSkees
af7e236ca3 refactor named colors into bidirectional map 2020-04-26 22:23:55 -04:00
ConnorSkees
4d989b60b1 remove final clamp! macro 2020-04-22 06:05:19 -04:00
ConnorSkees
d480e60628 replace clamp! macro with builtin method 2020-04-21 17:59:40 -04:00
ConnorSkees
a5b54e3ed0 toplevel docs for color module 2020-04-17 13:16:15 -04:00
ConnorSkees
de78c1147a manually resolve some formatting issues 2020-04-17 13:06:54 -04:00
ConnorSkees
0be8828bf0 make better use of num traits 2020-03-22 22:28:54 -04:00
ConnorSkees
4954f4bc6a better docs for colors 2020-03-19 16:40:30 -04:00
ConnorSkees
53861ccb0d clippy 2020-02-22 17:57:13 -05:00
ConnorSkees
87579b181b clippy 2020-02-16 18:03:19 -05:00
ConnorSkees
948c489785 Properly implement weighted inversion 2020-02-16 16:53:28 -05:00
ConnorSkees
5f59c71752 Bounds checking macro for builtin functions 2020-02-16 15:14:14 -05:00
ConnorSkees
fcb5069f82 Keep track of original values given from hsla() 2020-02-16 15:06:02 -05:00
ConnorSkees
639fa99abc Split Color into HSLA and RGBA representations 2020-02-16 14:19:04 -05:00
ConnorSkees
0e53318c9e Add named color transparent 2020-02-16 12:23:08 -05:00
ConnorSkees
a35fa119e0 Implement builtin function ie-hex-str() 2020-02-14 20:34:12 -05:00
ConnorSkees
19f59efd98 Handle alpha over 1 (a little bit) 2020-02-14 20:13:58 -05:00
ConnorSkees
c16d6fed4e clippy 2020-02-14 18:28:09 -05:00
ConnorSkees
ae9b97a6b2 Properly handle hue values above and below maximum 2020-02-14 18:02:48 -05:00
ConnorSkees
4303bd451c Handle negative hues 2020-02-14 17:52:25 -05:00
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
3af2292d5b Implement builtin function complement() 2020-02-14 12:56:28 -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
38802b69c5 Fix hue algorithm when red == blue and red > green 2020-02-14 09:46:50 -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
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
b8d8824db9 Lex and parse negative numbers 2020-02-09 15:08:33 -05:00
ConnorSkees
bc0c1d35f6 Clamp values passed to from_hsla() 2020-02-09 14:24:27 -05:00