2016-09-25 03:58:32 +02:00
|
|
|
// Copyright 2016 Google Inc. Use of this source code is governed by an
|
|
|
|
// MIT-style license that can be found in the LICENSE file or at
|
|
|
|
// https://opensource.org/licenses/MIT.
|
|
|
|
|
2016-11-03 01:00:03 +01:00
|
|
|
import 'package:collection/collection.dart';
|
|
|
|
|
2016-09-25 03:58:32 +02:00
|
|
|
import 'utils.dart';
|
|
|
|
import 'value.dart';
|
|
|
|
|
2016-10-10 05:57:10 +02:00
|
|
|
/// A map from (lowercase) color names to their color values.
|
2017-05-19 01:49:58 +02:00
|
|
|
final colorsByName = normalizedMap<SassColor>({
|
2017-05-28 02:44:43 +02:00
|
|
|
// Note: these are in reverse alphabetical order so that colors with multiple
|
|
|
|
// names will use the alphabetically first option in [namesByColor].
|
|
|
|
'yellowgreen': new SassColor.rgb(0x9A, 0xCD, 0x32),
|
|
|
|
'yellow': new SassColor.rgb(0xFF, 0xFF, 0x00),
|
|
|
|
'whitesmoke': new SassColor.rgb(0xF5, 0xF5, 0xF5),
|
|
|
|
'white': new SassColor.rgb(0xFF, 0xFF, 0xFF),
|
|
|
|
'wheat': new SassColor.rgb(0xF5, 0xDE, 0xB3),
|
|
|
|
'violet': new SassColor.rgb(0xEE, 0x82, 0xEE),
|
|
|
|
'turquoise': new SassColor.rgb(0x40, 0xE0, 0xD0),
|
|
|
|
'transparent': new SassColor.rgb(0, 0, 0, 0),
|
|
|
|
'tomato': new SassColor.rgb(0xFF, 0x63, 0x47),
|
|
|
|
'thistle': new SassColor.rgb(0xD8, 0xBF, 0xD8),
|
|
|
|
'teal': new SassColor.rgb(0x00, 0x80, 0x80),
|
|
|
|
'tan': new SassColor.rgb(0xD2, 0xB4, 0x8C),
|
|
|
|
'steelblue': new SassColor.rgb(0x46, 0x82, 0xB4),
|
|
|
|
'springgreen': new SassColor.rgb(0x00, 0xFF, 0x7F),
|
|
|
|
'snow': new SassColor.rgb(0xFF, 0xFA, 0xFA),
|
|
|
|
'slategrey': new SassColor.rgb(0x70, 0x80, 0x90),
|
|
|
|
'slategray': new SassColor.rgb(0x70, 0x80, 0x90),
|
|
|
|
'slateblue': new SassColor.rgb(0x6A, 0x5A, 0xCD),
|
|
|
|
'skyblue': new SassColor.rgb(0x87, 0xCE, 0xEB),
|
|
|
|
'silver': new SassColor.rgb(0xC0, 0xC0, 0xC0),
|
|
|
|
'sienna': new SassColor.rgb(0xA0, 0x52, 0x2D),
|
|
|
|
'seashell': new SassColor.rgb(0xFF, 0xF5, 0xEE),
|
|
|
|
'seagreen': new SassColor.rgb(0x2E, 0x8B, 0x57),
|
|
|
|
'sandybrown': new SassColor.rgb(0xF4, 0xA4, 0x60),
|
|
|
|
'salmon': new SassColor.rgb(0xFA, 0x80, 0x72),
|
|
|
|
'saddlebrown': new SassColor.rgb(0x8B, 0x45, 0x13),
|
|
|
|
'royalblue': new SassColor.rgb(0x41, 0x69, 0xE1),
|
|
|
|
'rosybrown': new SassColor.rgb(0xBC, 0x8F, 0x8F),
|
|
|
|
'red': new SassColor.rgb(0xFF, 0x00, 0x00),
|
|
|
|
'rebeccapurple': new SassColor.rgb(0x66, 0x33, 0x99),
|
|
|
|
'purple': new SassColor.rgb(0x80, 0x00, 0x80),
|
|
|
|
'powderblue': new SassColor.rgb(0xB0, 0xE0, 0xE6),
|
|
|
|
'plum': new SassColor.rgb(0xDD, 0xA0, 0xDD),
|
|
|
|
'pink': new SassColor.rgb(0xFF, 0xC0, 0xCB),
|
|
|
|
'peru': new SassColor.rgb(0xCD, 0x85, 0x3F),
|
|
|
|
'peachpuff': new SassColor.rgb(0xFF, 0xDA, 0xB9),
|
|
|
|
'papayawhip': new SassColor.rgb(0xFF, 0xEF, 0xD5),
|
|
|
|
'palevioletred': new SassColor.rgb(0xDB, 0x70, 0x93),
|
|
|
|
'paleturquoise': new SassColor.rgb(0xAF, 0xEE, 0xEE),
|
|
|
|
'palegreen': new SassColor.rgb(0x98, 0xFB, 0x98),
|
|
|
|
'palegoldenrod': new SassColor.rgb(0xEE, 0xE8, 0xAA),
|
|
|
|
'orchid': new SassColor.rgb(0xDA, 0x70, 0xD6),
|
|
|
|
'orangered': new SassColor.rgb(0xFF, 0x45, 0x00),
|
|
|
|
'orange': new SassColor.rgb(0xFF, 0xA5, 0x00),
|
|
|
|
'olivedrab': new SassColor.rgb(0x6B, 0x8E, 0x23),
|
|
|
|
'olive': new SassColor.rgb(0x80, 0x80, 0x00),
|
|
|
|
'oldlace': new SassColor.rgb(0xFD, 0xF5, 0xE6),
|
|
|
|
'navy': new SassColor.rgb(0x00, 0x00, 0x80),
|
|
|
|
'navajowhite': new SassColor.rgb(0xFF, 0xDE, 0xAD),
|
|
|
|
'moccasin': new SassColor.rgb(0xFF, 0xE4, 0xB5),
|
|
|
|
'mistyrose': new SassColor.rgb(0xFF, 0xE4, 0xE1),
|
|
|
|
'mintcream': new SassColor.rgb(0xF5, 0xFF, 0xFA),
|
|
|
|
'midnightblue': new SassColor.rgb(0x19, 0x19, 0x70),
|
|
|
|
'mediumvioletred': new SassColor.rgb(0xC7, 0x15, 0x85),
|
|
|
|
'mediumturquoise': new SassColor.rgb(0x48, 0xD1, 0xCC),
|
|
|
|
'mediumspringgreen': new SassColor.rgb(0x00, 0xFA, 0x9A),
|
|
|
|
'mediumslateblue': new SassColor.rgb(0x7B, 0x68, 0xEE),
|
|
|
|
'mediumseagreen': new SassColor.rgb(0x3C, 0xB3, 0x71),
|
|
|
|
'mediumpurple': new SassColor.rgb(0x93, 0x70, 0xDB),
|
|
|
|
'mediumorchid': new SassColor.rgb(0xBA, 0x55, 0xD3),
|
|
|
|
'mediumblue': new SassColor.rgb(0x00, 0x00, 0xCD),
|
|
|
|
'mediumaquamarine': new SassColor.rgb(0x66, 0xCD, 0xAA),
|
|
|
|
'maroon': new SassColor.rgb(0x80, 0x00, 0x00),
|
|
|
|
'magenta': new SassColor.rgb(0xFF, 0x00, 0xFF),
|
|
|
|
'linen': new SassColor.rgb(0xFA, 0xF0, 0xE6),
|
|
|
|
'limegreen': new SassColor.rgb(0x32, 0xCD, 0x32),
|
|
|
|
'lime': new SassColor.rgb(0x00, 0xFF, 0x00),
|
|
|
|
'lightyellow': new SassColor.rgb(0xFF, 0xFF, 0xE0),
|
|
|
|
'lightsteelblue': new SassColor.rgb(0xB0, 0xC4, 0xDE),
|
|
|
|
'lightslategrey': new SassColor.rgb(0x77, 0x88, 0x99),
|
|
|
|
'lightslategray': new SassColor.rgb(0x77, 0x88, 0x99),
|
|
|
|
'lightskyblue': new SassColor.rgb(0x87, 0xCE, 0xFA),
|
|
|
|
'lightseagreen': new SassColor.rgb(0x20, 0xB2, 0xAA),
|
|
|
|
'lightsalmon': new SassColor.rgb(0xFF, 0xA0, 0x7A),
|
|
|
|
'lightpink': new SassColor.rgb(0xFF, 0xB6, 0xC1),
|
|
|
|
'lightgrey': new SassColor.rgb(0xD3, 0xD3, 0xD3),
|
2016-10-20 02:56:48 +02:00
|
|
|
'lightgreen': new SassColor.rgb(0x90, 0xEE, 0x90),
|
|
|
|
'lightgray': new SassColor.rgb(0xD3, 0xD3, 0xD3),
|
2017-05-28 02:44:43 +02:00
|
|
|
'lightgoldenrodyellow': new SassColor.rgb(0xFA, 0xFA, 0xD2),
|
|
|
|
'lightcyan': new SassColor.rgb(0xE0, 0xFF, 0xFF),
|
|
|
|
'lightcoral': new SassColor.rgb(0xF0, 0x80, 0x80),
|
|
|
|
'lightblue': new SassColor.rgb(0xAD, 0xD8, 0xE6),
|
|
|
|
'lemonchiffon': new SassColor.rgb(0xFF, 0xFA, 0xCD),
|
|
|
|
'lawngreen': new SassColor.rgb(0x7C, 0xFC, 0x00),
|
|
|
|
'lavenderblush': new SassColor.rgb(0xFF, 0xF0, 0xF5),
|
|
|
|
'lavender': new SassColor.rgb(0xE6, 0xE6, 0xFA),
|
|
|
|
'khaki': new SassColor.rgb(0xF0, 0xE6, 0x8C),
|
|
|
|
'ivory': new SassColor.rgb(0xFF, 0xFF, 0xF0),
|
|
|
|
'indigo': new SassColor.rgb(0x4B, 0x00, 0x82),
|
|
|
|
'indianred': new SassColor.rgb(0xCD, 0x5C, 0x5C),
|
|
|
|
'hotpink': new SassColor.rgb(0xFF, 0x69, 0xB4),
|
|
|
|
'honeydew': new SassColor.rgb(0xF0, 0xFF, 0xF0),
|
|
|
|
'grey': new SassColor.rgb(0x80, 0x80, 0x80),
|
|
|
|
'greenyellow': new SassColor.rgb(0xAD, 0xFF, 0x2F),
|
|
|
|
'green': new SassColor.rgb(0x00, 0x80, 0x00),
|
|
|
|
'gray': new SassColor.rgb(0x80, 0x80, 0x80),
|
|
|
|
'goldenrod': new SassColor.rgb(0xDA, 0xA5, 0x20),
|
|
|
|
'gold': new SassColor.rgb(0xFF, 0xD7, 0x00),
|
|
|
|
'ghostwhite': new SassColor.rgb(0xF8, 0xF8, 0xFF),
|
|
|
|
'gainsboro': new SassColor.rgb(0xDC, 0xDC, 0xDC),
|
2016-10-20 02:56:48 +02:00
|
|
|
'fuchsia': new SassColor.rgb(0xFF, 0x00, 0xFF),
|
2017-05-28 02:44:43 +02:00
|
|
|
'forestgreen': new SassColor.rgb(0x22, 0x8B, 0x22),
|
|
|
|
'floralwhite': new SassColor.rgb(0xFF, 0xFA, 0xF0),
|
|
|
|
'firebrick': new SassColor.rgb(0xB2, 0x22, 0x22),
|
|
|
|
'dodgerblue': new SassColor.rgb(0x1E, 0x90, 0xFF),
|
|
|
|
'dimgrey': new SassColor.rgb(0x69, 0x69, 0x69),
|
|
|
|
'dimgray': new SassColor.rgb(0x69, 0x69, 0x69),
|
|
|
|
'deepskyblue': new SassColor.rgb(0x00, 0xBF, 0xFF),
|
|
|
|
'deeppink': new SassColor.rgb(0xFF, 0x14, 0x93),
|
|
|
|
'darkviolet': new SassColor.rgb(0x94, 0x00, 0xD3),
|
|
|
|
'darkturquoise': new SassColor.rgb(0x00, 0xCE, 0xD1),
|
|
|
|
'darkslategrey': new SassColor.rgb(0x2F, 0x4F, 0x4F),
|
|
|
|
'darkslategray': new SassColor.rgb(0x2F, 0x4F, 0x4F),
|
|
|
|
'darkslateblue': new SassColor.rgb(0x48, 0x3D, 0x8B),
|
|
|
|
'darkseagreen': new SassColor.rgb(0x8F, 0xBC, 0x8F),
|
|
|
|
'darksalmon': new SassColor.rgb(0xE9, 0x96, 0x7A),
|
|
|
|
'darkred': new SassColor.rgb(0x8B, 0x00, 0x00),
|
|
|
|
'darkorchid': new SassColor.rgb(0x99, 0x32, 0xCC),
|
|
|
|
'darkorange': new SassColor.rgb(0xFF, 0x8C, 0x00),
|
|
|
|
'darkolivegreen': new SassColor.rgb(0x55, 0x6B, 0x2F),
|
|
|
|
'darkmagenta': new SassColor.rgb(0x8B, 0x00, 0x8B),
|
|
|
|
'darkkhaki': new SassColor.rgb(0xBD, 0xB7, 0x6B),
|
|
|
|
'darkgrey': new SassColor.rgb(0xA9, 0xA9, 0xA9),
|
|
|
|
'darkgreen': new SassColor.rgb(0x00, 0x64, 0x00),
|
|
|
|
'darkgray': new SassColor.rgb(0xA9, 0xA9, 0xA9),
|
|
|
|
'darkgoldenrod': new SassColor.rgb(0xB8, 0x86, 0x0B),
|
|
|
|
'darkcyan': new SassColor.rgb(0x00, 0x8B, 0x8B),
|
|
|
|
'darkblue': new SassColor.rgb(0x00, 0x00, 0x8B),
|
|
|
|
'cyan': new SassColor.rgb(0x00, 0xFF, 0xFF),
|
|
|
|
'crimson': new SassColor.rgb(0xDC, 0x14, 0x3C),
|
|
|
|
'cornsilk': new SassColor.rgb(0xFF, 0xF8, 0xDC),
|
|
|
|
'cornflowerblue': new SassColor.rgb(0x64, 0x95, 0xED),
|
|
|
|
'coral': new SassColor.rgb(0xFF, 0x7F, 0x50),
|
|
|
|
'chocolate': new SassColor.rgb(0xD2, 0x69, 0x1E),
|
|
|
|
'chartreuse': new SassColor.rgb(0x7F, 0xFF, 0x00),
|
|
|
|
'cadetblue': new SassColor.rgb(0x5F, 0x9E, 0xA0),
|
|
|
|
'burlywood': new SassColor.rgb(0xDE, 0xB8, 0x87),
|
|
|
|
'brown': new SassColor.rgb(0xA5, 0x2A, 0x2A),
|
|
|
|
'blueviolet': new SassColor.rgb(0x8A, 0x2B, 0xE2),
|
|
|
|
'blue': new SassColor.rgb(0x00, 0x00, 0xFF),
|
|
|
|
'blanchedalmond': new SassColor.rgb(0xFF, 0xEB, 0xCD),
|
|
|
|
'black': new SassColor.rgb(0x00, 0x00, 0x00),
|
|
|
|
'bisque': new SassColor.rgb(0xFF, 0xE4, 0xC4),
|
|
|
|
'beige': new SassColor.rgb(0xF5, 0xF5, 0xDC),
|
|
|
|
'azure': new SassColor.rgb(0xF0, 0xFF, 0xFF),
|
|
|
|
'aquamarine': new SassColor.rgb(0x7F, 0xFF, 0xD4),
|
|
|
|
'aqua': new SassColor.rgb(0x00, 0xFF, 0xFF),
|
|
|
|
'antiquewhite': new SassColor.rgb(0xFA, 0xEB, 0xD7),
|
|
|
|
'aliceblue': new SassColor.rgb(0xF0, 0xF8, 0xFF),
|
2016-10-20 02:56:48 +02:00
|
|
|
});
|
2016-11-03 01:00:03 +01:00
|
|
|
|
|
|
|
/// A map from Sass colors to (lowercase) color names.
|
2017-05-19 01:47:22 +02:00
|
|
|
final namesByColor = mapMap<String, SassColor, SassColor, String>(colorsByName,
|
|
|
|
key: (_, color) => color, value: (name, _) => name);
|