Skip to content

Commit

Permalink
enforce aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYinMD committed Dec 10, 2018
1 parent 65f048a commit 3a07819
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 21 deletions.
16 changes: 13 additions & 3 deletions palettes/sepia/palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// this file will be used both by node and by browser

var palette = {
const palette = {
grey: '#836e69',
silver: '#999c',
black: '#2d2d2d',
Expand All @@ -25,7 +25,7 @@ var palette = {
teal: '#088',
};

var alias = {
const aliases = {
default: palette.grey,
variable: palette.olive,
property: palette.olive,
Expand All @@ -34,13 +34,23 @@ var alias = {
parameter: palette.yellow,
module: palette.maroon,
declaration: palette.blue,
tag: palette.blue,
string: palette.tan,
reserved: palette.magenta,
builtIn: palette.teal,
inherited: palette.teal,
number: palette.orange,
operator: palette.orange,
control: palette.orange,
flow: palette.black,
constant: palette.purple,
keyword: palette.yellow,
invalid: palette.red,
deprecated: palette.pink,
}

try {
module.exports = Object.assign(palette, alias);
module.exports = Object.assign(palette, aliases);
} catch (err) {
// the exports can be used in node, browser doesn't understand it, but browser can use the palette.
}
25 changes: 15 additions & 10 deletions syntax-highlighting-rules/sepia/basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"entity.other.inherited-class"
],
"settings": {
"foreground": "teal"
"foreground": "inherited"
}
},
{
Expand All @@ -51,6 +51,8 @@
{
"name": "properties",
"scope": [
"variable.other.property", // e.g. property of js object
"variable.other.object.property", // e.g. property of a property of js object
"support.type.property-name", // e.g. JSON key name
"meta.object-literal.key" // e.g. key name of object literal
],
Expand All @@ -71,7 +73,8 @@
"name": "built-in variables of runtime: window, document, prototype, etc",
"scope": [
"support.variable",
"support.class"
"support.class",
"support.constant"
],
"settings": {
"foreground": "builtIn"
Expand All @@ -92,7 +95,7 @@
"variable.function" // never encountered this scope in real code
],
"settings": {
"foreground": "red"
"foreground": "builtIn"
}
},
{
Expand All @@ -101,7 +104,7 @@
"constant"
],
"settings": {
"foreground": "purple"
"foreground": "constant"
}
},
{
Expand All @@ -110,7 +113,7 @@
"constant.numeric"
],
"settings": {
"foreground": "orange"
"foreground": "number"
}
},
{
Expand Down Expand Up @@ -138,6 +141,8 @@
"keyword.export",
"keyword.control.import",
"keyword.control.export",
"keyword.other.import",
"keyword.other.export",
"keyword.control.directive.include"
// "meta.import",
// "meta.export"
Expand All @@ -152,7 +157,7 @@
"keyword.control"
],
"settings": {
"foreground": "orange"
"foreground": "control"
}
},
{
Expand All @@ -165,7 +170,7 @@

],
"settings": {
"foreground": "black"
"foreground": "flow"
}
},
{
Expand All @@ -174,7 +179,7 @@
"keyword.operator"
],
"settings": {
"foreground": "orange"
"foreground": "operator"
}
},
{
Expand All @@ -183,7 +188,7 @@
"keyword"
],
"settings": {
"foreground": "yellow"
"foreground": "keyword"
}
},
{
Expand Down Expand Up @@ -226,7 +231,7 @@
"invalid.deprecated"
],
"settings": {
"foreground": "pink"
"foreground": "deprecated"
}
}
]
19 changes: 12 additions & 7 deletions syntax-highlighting-rules/sepia/css.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,30 @@
}
},
{
"name": "CSS: property value",
"name": "CSS: property value", // needs to be specified because support.constant was colored as "builtIn"
"scope": [
"meta.property-value"
"meta.property-value",
"support.constant.property-value",
"support.constant.font-name",
"support.constant.media-type",
"support.constant.media"
],
"settings": {
"foreground": "tan"
"foreground": "string"
}
},
{
"name": "CSS: @",
"scope": "keyword.control.at-rule",
"settings": {
"foreground": "maroon"
"foreground": "module"
}
},
{
"name": "CSS: !important",
"scope": "keyword.other.important",
"settings": {
"foreground": "maroon"
"foreground": "module"
}
},
{
Expand All @@ -40,13 +44,14 @@
"support.constant.color"
],
"settings": {
"foreground": "orange" // color names should be colorless
"foreground": "number"
}
},
{
"name": "color names in English",
"scope": [
"support.constant.color.w3c-standard-color-name.css"
"support.constant.color.w3c-standard-color-name.css",
"support.constant.color.w3c-extended-color-name"
],
"settings": {
"foreground": "default" // color names should be colorless
Expand Down
2 changes: 1 addition & 1 deletion syntax-highlighting-rules/sepia/markdown.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"entity.name.section"
],
"settings": {
"foreground": "cyan"
"foreground": "tag"
}
}
]

0 comments on commit 3a07819

Please sign in to comment.