diff --git a/pkgs/csslib/CHANGELOG.md b/pkgs/csslib/CHANGELOG.md index dbfd91d62..3bd0734d1 100644 --- a/pkgs/csslib/CHANGELOG.md +++ b/pkgs/csslib/CHANGELOG.md @@ -1,5 +1,6 @@ ## 1.0.3-wip +- Recognize the `rebeccapurple` color keyword. - Correctly parse unit-like type selectors (`rem`, `vw`, `dpi`, etc.) at the start of `selector()` and `parseSelectorGroup()` input and of style rules. - Fix `@namespace` serialization: quote bare URIs in pretty output and stop diff --git a/pkgs/csslib/lib/src/token_kind.dart b/pkgs/csslib/lib/src/token_kind.dart index 7f66d9232..60b62008f 100644 --- a/pkgs/csslib/lib/src/token_kind.dart +++ b/pkgs/csslib/lib/src/token_kind.dart @@ -421,6 +421,7 @@ class TokenKind { {'name': 'plum', 'value': 0xDDA0DD}, {'name': 'powderblue', 'value': 0xB0E0E6}, {'name': 'purple', 'value': 0x800080}, + {'name': 'rebeccapurple', 'value': 0x663399}, {'name': 'red', 'value': 0xFF0000}, {'name': 'rosybrown', 'value': 0xBC8F8F}, {'name': 'royalblue', 'value': 0x4169E1}, diff --git a/pkgs/csslib/test/color_keyword_test.dart b/pkgs/csslib/test/color_keyword_test.dart new file mode 100644 index 000000000..b24dc4545 --- /dev/null +++ b/pkgs/csslib/test/color_keyword_test.dart @@ -0,0 +1,15 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:csslib/parser.dart'; +import 'package:test/test.dart'; + +void main() { + test('rebeccapurple is a named color', () { + expect(TokenKind.colorValue(TokenKind.matchColorName('rebeccapurple')!), + 0x663399); + expect(TokenKind.colorValue(TokenKind.matchColorName('RebeccaPurple')!), + 0x663399); + }); +}