diff --git a/assets/themes/ansi-dark.tmTheme b/assets/themes/ansi-dark.tmTheme new file mode 100644 index 00000000..a7976951 --- /dev/null +++ b/assets/themes/ansi-dark.tmTheme @@ -0,0 +1,504 @@ + + + + + + author + Template: Chris Kempson, Scheme: Mitchell Kember + name + ANSI Dark + colorSpaceName + sRGB + settings + + + settings + + background + #00000000 + caret + #07000000 + foreground + #07000000 + invisibles + #07000000 + lineHighlight + #07000000 + selection + #07000000 + gutter + #00000000 + gutterForeground + #07000000 + + + + name + Text + scope + variable.parameter.function + settings + + foreground + #07000000 + + + + name + Comments + scope + comment, punctuation.definition.comment + settings + + foreground + #02000000 + + + + name + Punctuation + scope + punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array + settings + + foreground + #07000000 + + + + name + Delimiters + scope + none + settings + + foreground + #07000000 + + + + name + Operators + scope + keyword.operator + settings + + foreground + #07000000 + + + + name + Keywords + scope + keyword + settings + + foreground + #05000000 + + + + name + Variables + scope + variable + settings + + foreground + #07000000 + + + + name + Functions + scope + entity.name.function, meta.require, support.function.any-method + settings + + foreground + #04000000 + + + + name + Labels + scope + entity.name.label + settings + + foreground + #06000000 + + + + name + Classes + scope + support.class, entity.name.class, entity.name.type.class + settings + + foreground + #03000000 + + + + name + Classes + scope + meta.class + settings + + foreground + #07000000 + + + + name + Methods + scope + keyword.other.special-method + settings + + foreground + #04000000 + + + + name + Storage + scope + storage + settings + + foreground + #05000000 + + + + name + Support + scope + support.function + settings + + foreground + #06000000 + + + + name + Strings, Inherited Class + scope + string, constant.other.symbol, entity.other.inherited-class + settings + + foreground + #02000000 + + + + name + Integers + scope + constant.numeric + settings + + foreground + #03000000 + + + + name + Floats + scope + none + settings + + foreground + #03000000 + + + + name + Boolean + scope + none + settings + + foreground + #03000000 + + + + name + Constants + scope + constant + settings + + foreground + #03000000 + + + + name + Tags + scope + entity.name.tag + settings + + foreground + #01000000 + + + + name + Attributes + scope + entity.other.attribute-name + settings + + foreground + #03000000 + + + + name + Attribute IDs + scope + entity.other.attribute-name.id, punctuation.definition.entity + settings + + foreground + #04000000 + + + + name + Selector + scope + meta.selector + settings + + foreground + #05000000 + + + + name + Values + scope + none + settings + + foreground + #03000000 + + + + name + Headings + scope + markup.heading punctuation.definition.heading, entity.name.section + settings + + fontStyle + + foreground + #04000000 + + + + name + Units + scope + keyword.other.unit + settings + + foreground + #03000000 + + + + name + Bold + scope + markup.bold, punctuation.definition.bold + settings + + fontStyle + bold + foreground + #03000000 + + + + name + Italic + scope + markup.italic, punctuation.definition.italic + settings + + fontStyle + italic + foreground + #05000000 + + + + name + Code + scope + markup.raw.inline + settings + + foreground + #02000000 + + + + name + Link Text + scope + string.other.link, punctuation.definition.string.end.markdown, punctuation.definition.string.begin.markdown + settings + + foreground + #01000000 + + + + name + Link Url + scope + meta.link + settings + + foreground + #03000000 + + + + name + Quotes + scope + markup.quote + settings + + foreground + #03000000 + + + + name + Inserted + scope + markup.inserted + settings + + foreground + #02000000 + + + + name + Deleted + scope + markup.deleted + settings + + foreground + #01000000 + + + + name + Changed + scope + markup.changed + settings + + foreground + #05000000 + + + + name + Colors + scope + constant.other.color + settings + + foreground + #06000000 + + + + name + Regular Expressions + scope + string.regexp + settings + + foreground + #06000000 + + + + name + Escape Characters + scope + constant.character.escape + settings + + foreground + #06000000 + + + + name + Embedded + scope + punctuation.section.embedded, variable.interpolation + settings + + foreground + #05000000 + + + + name + Illegal + scope + invalid.illegal + settings + + background + #01000000 + foreground + #07000000 + + + + name + Broken + scope + invalid.broken + settings + + background + #03000000 + foreground + #00000000 + + + + uuid + uuid + + diff --git a/assets/themes/ansi-light.tmTheme b/assets/themes/ansi-light.tmTheme new file mode 100644 index 00000000..5dfb94e8 --- /dev/null +++ b/assets/themes/ansi-light.tmTheme @@ -0,0 +1,504 @@ + + + + + + author + Template: Chris Kempson, Scheme: Mitchell Kember + name + ANSI Light + colorSpaceName + sRGB + settings + + + settings + + background + #07000000 + caret + #00000000 + foreground + #00000000 + invisibles + #00000000 + lineHighlight + #00000000 + selection + #00000000 + gutter + #07000000 + gutterForeground + #00000000 + + + + name + Text + scope + variable.parameter.function + settings + + foreground + #00000000 + + + + name + Comments + scope + comment, punctuation.definition.comment + settings + + foreground + #02000000 + + + + name + Punctuation + scope + punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array + settings + + foreground + #00000000 + + + + name + Delimiters + scope + none + settings + + foreground + #00000000 + + + + name + Operators + scope + keyword.operator + settings + + foreground + #00000000 + + + + name + Keywords + scope + keyword + settings + + foreground + #05000000 + + + + name + Variables + scope + variable + settings + + foreground + #00000000 + + + + name + Functions + scope + entity.name.function, meta.require, support.function.any-method + settings + + foreground + #04000000 + + + + name + Labels + scope + entity.name.label + settings + + foreground + #06000000 + + + + name + Classes + scope + support.class, entity.name.class, entity.name.type.class + settings + + foreground + #03000000 + + + + name + Classes + scope + meta.class + settings + + foreground + #00000000 + + + + name + Methods + scope + keyword.other.special-method + settings + + foreground + #04000000 + + + + name + Storage + scope + storage + settings + + foreground + #05000000 + + + + name + Support + scope + support.function + settings + + foreground + #06000000 + + + + name + Strings, Inherited Class + scope + string, constant.other.symbol, entity.other.inherited-class + settings + + foreground + #02000000 + + + + name + Integers + scope + constant.numeric + settings + + foreground + #03000000 + + + + name + Floats + scope + none + settings + + foreground + #03000000 + + + + name + Boolean + scope + none + settings + + foreground + #03000000 + + + + name + Constants + scope + constant + settings + + foreground + #03000000 + + + + name + Tags + scope + entity.name.tag + settings + + foreground + #01000000 + + + + name + Attributes + scope + entity.other.attribute-name + settings + + foreground + #03000000 + + + + name + Attribute IDs + scope + entity.other.attribute-name.id, punctuation.definition.entity + settings + + foreground + #04000000 + + + + name + Selector + scope + meta.selector + settings + + foreground + #05000000 + + + + name + Values + scope + none + settings + + foreground + #03000000 + + + + name + Headings + scope + markup.heading punctuation.definition.heading, entity.name.section + settings + + fontStyle + + foreground + #04000000 + + + + name + Units + scope + keyword.other.unit + settings + + foreground + #03000000 + + + + name + Bold + scope + markup.bold, punctuation.definition.bold + settings + + fontStyle + bold + foreground + #03000000 + + + + name + Italic + scope + markup.italic, punctuation.definition.italic + settings + + fontStyle + italic + foreground + #05000000 + + + + name + Code + scope + markup.raw.inline + settings + + foreground + #02000000 + + + + name + Link Text + scope + string.other.link, punctuation.definition.string.end.markdown, punctuation.definition.string.begin.markdown + settings + + foreground + #01000000 + + + + name + Link Url + scope + meta.link + settings + + foreground + #03000000 + + + + name + Quotes + scope + markup.quote + settings + + foreground + #03000000 + + + + name + Inserted + scope + markup.inserted + settings + + foreground + #02000000 + + + + name + Deleted + scope + markup.deleted + settings + + foreground + #01000000 + + + + name + Changed + scope + markup.changed + settings + + foreground + #05000000 + + + + name + Colors + scope + constant.other.color + settings + + foreground + #06000000 + + + + name + Regular Expressions + scope + string.regexp + settings + + foreground + #06000000 + + + + name + Escape Characters + scope + constant.character.escape + settings + + foreground + #06000000 + + + + name + Embedded + scope + punctuation.section.embedded, variable.interpolation + settings + + foreground + #05000000 + + + + name + Illegal + scope + invalid.illegal + settings + + background + #01000000 + foreground + #00000000 + + + + name + Broken + scope + invalid.broken + settings + + background + #03000000 + foreground + #07000000 + + + + uuid + uuid + + diff --git a/assets/themes/base16.tmTheme b/assets/themes/base16.tmTheme new file mode 100644 index 00000000..eff2eba4 --- /dev/null +++ b/assets/themes/base16.tmTheme @@ -0,0 +1,543 @@ + + + + + + author + Template: Chris Kempson, Scheme: Mitchell Kember + name + Base16 + colorSpaceName + sRGB + settings + + + settings + + background + #00000000 + caret + #07000000 + foreground + #07000000 + invisibles + #08000000 + lineHighlight + #08000000 + selection + #0b000000 + gutter + #0a000000 + gutterForeground + #08000000 + + + + name + Text + scope + variable.parameter.function + settings + + foreground + #07000000 + + + + name + Comments + scope + comment, punctuation.definition.comment + settings + + foreground + #08000000 + + + + name + Punctuation + scope + punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array + settings + + foreground + #07000000 + + + + name + Delimiters + scope + none + settings + + foreground + #07000000 + + + + name + Operators + scope + keyword.operator + settings + + foreground + #07000000 + + + + name + Keywords + scope + keyword + settings + + foreground + #05000000 + + + + name + Variables + scope + variable + settings + + foreground + #07000000 + + + + name + Functions + scope + entity.name.function, meta.require, support.function.any-method + settings + + foreground + #04000000 + + + + name + Labels + scope + entity.name.label + settings + + foreground + #0e000000 + + + + name + Classes + scope + support.class, entity.name.class, entity.name.type.class + settings + + foreground + #03000000 + + + + name + Classes + scope + meta.class + settings + + foreground + #0f000000 + + + + name + Methods + scope + keyword.other.special-method + settings + + foreground + #04000000 + + + + name + Storage + scope + storage + settings + + foreground + #05000000 + + + + name + Support + scope + support.function + settings + + foreground + #06000000 + + + + name + Strings, Inherited Class + scope + string, constant.other.symbol, entity.other.inherited-class + settings + + foreground + #02000000 + + + + name + Integers + scope + constant.numeric + settings + + foreground + #09000000 + + + + name + Floats + scope + none + settings + + foreground + #09000000 + + + + name + Boolean + scope + none + settings + + foreground + #09000000 + + + + name + Constants + scope + constant + settings + + foreground + #09000000 + + + + name + Tags + scope + entity.name.tag + settings + + foreground + #01000000 + + + + name + Attributes + scope + entity.other.attribute-name + settings + + foreground + #09000000 + + + + name + Attribute IDs + scope + entity.other.attribute-name.id, punctuation.definition.entity + settings + + foreground + #04000000 + + + + name + Selector + scope + meta.selector + settings + + foreground + #05000000 + + + + name + Values + scope + none + settings + + foreground + #09000000 + + + + name + Headings + scope + markup.heading punctuation.definition.heading, entity.name.section + settings + + fontStyle + + foreground + #04000000 + + + + name + Units + scope + keyword.other.unit + settings + + foreground + #09000000 + + + + name + Bold + scope + markup.bold, punctuation.definition.bold + settings + + fontStyle + bold + foreground + #03000000 + + + + name + Italic + scope + markup.italic, punctuation.definition.italic + settings + + fontStyle + italic + foreground + #05000000 + + + + name + Code + scope + markup.raw.inline + settings + + foreground + #02000000 + + + + name + Link Text + scope + string.other.link, punctuation.definition.string.end.markdown, punctuation.definition.string.begin.markdown + settings + + foreground + #01000000 + + + + name + Link Url + scope + meta.link + settings + + foreground + #09000000 + + + + name + Quotes + scope + markup.quote + settings + + foreground + #09000000 + + + + name + Separator + scope + meta.separator + settings + + background + #0b000000 + foreground + #07000000 + + + + name + Inserted + scope + markup.inserted + settings + + foreground + #02000000 + + + + name + Deleted + scope + markup.deleted + settings + + foreground + #01000000 + + + + name + Changed + scope + markup.changed + settings + + foreground + #05000000 + + + + name + Colors + scope + constant.other.color + settings + + foreground + #06000000 + + + + name + Regular Expressions + scope + string.regexp + settings + + foreground + #06000000 + + + + name + Escape Characters + scope + constant.character.escape + settings + + foreground + #06000000 + + + + name + Embedded + scope + punctuation.section.embedded, variable.interpolation + settings + + foreground + #05000000 + + + + name + Illegal + scope + invalid.illegal + settings + + background + #01000000 + foreground + #0f000000 + + + + name + Broken + scope + invalid.broken + settings + + background + #09000000 + foreground + #00000000 + + + + name + Deprecated + scope + invalid.deprecated + settings + + background + #0e000000 + foreground + #0f000000 + + + + name + Unimplemented + scope + invalid.unimplemented + settings + + background + #08000000 + foreground + #0f000000 + + + + uuid + uuid + + diff --git a/src/terminal.rs b/src/terminal.rs index f01e9d60..b02e8618 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -6,7 +6,13 @@ use ansi_term::{self, Style}; use syntect::highlighting::{self, FontStyle}; pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term::Colour { - if true_color { + if color.a == 0 { + // Themes can specify one of the user-configurable terminal colors by + // encoding them as #RRGGBBAA with AA set to 00 (transparent) and RR set + // to the color palette number. The built-in themes ansi-light, + // ansi-dark, and base16 use this. + Fixed(color.r) + } else if true_color { RGB(color.r, color.g, color.b) } else { Fixed(ansi_colours::ansi256_from_rgb((color.r, color.g, color.b)))