Skip to content

Commit

Permalink
Add round() function
Browse files Browse the repository at this point in the history
  • Loading branch information
vrugtehagel authored and argyleink committed Jul 17, 2024
1 parent 9c69945 commit bc6de15
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions CSS3.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -2436,6 +2436,15 @@ contexts:
- meta_scope: meta.function.math-return-any.css
- include: value-calc
- include: end-func
- match: \b(round)(\()
captures:
1: support.function.math-return-any.css
2: punctuation.section.function.begin.css
push:
- meta_scope: meta.function.math-return-any.css
- include: rounding-strategy
- include: value-calc
- include: end-func

func-math-return-number:
- match: \b(cos|exp|log|pow|sign|sin|sqrt|tan)(\()
Expand Down Expand Up @@ -10867,6 +10876,10 @@ contexts:
- include: percentage
- include: number

rounding-strategy:
- match: '\b(nearest|up|down|to-zero){{b}}'
scope: support.constant.property-value.css

# A rule is a selector and a declaration list.
# selector {
# property1: value1;
Expand Down
5 changes: 5 additions & 0 deletions test/property-list.css
Original file line number Diff line number Diff line change
Expand Up @@ -4302,6 +4302,11 @@
line-height: sin(5deg);
line-height: sqrt(1.2 + .1);
line-height: tan(5deg + 10deg);
line-height: round(1.2);
line-height: round(nearest, 125%, 10%);
line-height: round(up, 5rem / 2, 1rem);
line-height: round(down, pi, 1);
line-height: round(to-zero, 5rem / 2, 1rem);

line-snap: initial;
line-snap: inherit;
Expand Down

0 comments on commit bc6de15

Please sign in to comment.