From d89c310d7a578ff31fdaa8386a4fb83a70169a32 Mon Sep 17 00:00:00 2001 From: Adam Norberg Date: Sat, 31 Dec 2022 14:12:38 -0800 Subject: [PATCH 01/10] Sublime Text 3 syntax file with new .P8 features This updates the syntax file to Sublime Text 3 format, includes new APIs, and recognizes the `\` and `!=` operators. --- PICO-8.sublime-syntax | 77 ++++++++++++++ PICO-8.tmLanguage | 228 ------------------------------------------ 2 files changed, 77 insertions(+), 228 deletions(-) create mode 100644 PICO-8.sublime-syntax delete mode 100644 PICO-8.tmLanguage diff --git a/PICO-8.sublime-syntax b/PICO-8.sublime-syntax new file mode 100644 index 0000000..5e75a42 --- /dev/null +++ b/PICO-8.sublime-syntax @@ -0,0 +1,77 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/syntax.html +name: PICO-8 +comment: PICO-8 (0.2.5e) +file_extensions: + - p8 +scope: source.p8 +contexts: + main: + - match: '\b(function)\s+([a-zA-Z_.:]+[.:])?([a-zA-Z_]\w*)\s*(\()([^)]*)(\))' + scope: meta.function.lua + captures: + 1: keyword.control.lua + 2: entity.name.function.scope.lua + 3: entity.name.function.lua + 4: punctuation.definition.parameters.begin.lua + 5: variable.parameter.function.lua + 6: punctuation.definition.parameters.end.lua + - match: '(?=?|,|\.\.?\.?|<<>?|>>>?|>><|(? - - - - comment - PICO-8 (lua syntax 0.8) - fileTypes - - p8 - - foldingStartMarker - ^\s*\b(function|local\s+function|if|for)\b|{[ \t]*$|\[\[ - foldingStopMarker - \bend\b|^\s*}|\]\] - keyEquivalent - ^~L - name - PICO-8 - patterns - - - captures - - 1 - - name - keyword.control.lua - - 2 - - name - entity.name.function.scope.lua - - 3 - - name - entity.name.function.lua - - 4 - - name - punctuation.definition.parameters.begin.lua - - 5 - - name - variable.parameter.function.lua - - 6 - - name - punctuation.definition.parameters.end.lua - - - match - \b(function)\s+([a-zA-Z_.:]+[.:])?([a-zA-Z_]\w*)\s*(\()([^)]*)(\)) - name - meta.function.lua - - - match - (?<![\d.])\b0x[a-fA-F\d]+|\b\d+(\.\d+)?([eE]-?\d+)?|\.\d+([eE]-?\d+)? - name - constant.numeric.lua - - - begin - ' - beginCaptures - - 0 - - name - punctuation.definition.string.begin.lua - - - end - ' - endCaptures - - 0 - - name - punctuation.definition.string.end.lua - - - name - string.quoted.single.lua - patterns - - - match - \\. - name - constant.character.escape.lua - - - - - begin - " - beginCaptures - - 0 - - name - punctuation.definition.string.begin.lua - - - end - " - endCaptures - - 0 - - name - punctuation.definition.string.end.lua - - - name - string.quoted.double.lua - patterns - - - match - \\. - name - constant.character.escape.lua - - - - - begin - (?<!--)\[(=*)\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.lua - - - end - \]\1\] - endCaptures - - 0 - - name - punctuation.definition.string.end.lua - - - name - string.quoted.other.multiline.lua - - - begin - --\[(=*)\[ - captures - - 0 - - name - punctuation.definition.comment.lua - - - end - \]\1\] - name - comment.block.lua - - - captures - - 1 - - name - punctuation.definition.comment.lua - - - match - (--)(?!\[\[).*$\n? - name - comment.line.double-dash.lua - - - match - \b(break|do|else|for|if|elseif|return|then|repeat|while|until|end|function|local|in|goto)\b - name - keyword.control.lua - - - match - (?<![^.]\.|:)\b(false|nil|true)\b - name - constant.language.lua - - - match - (?<![^.]\.|:)\b(self)\b - name - variable.language.self.lua - - - match - (?<![^.]\.|:)\b(_draw|_init|_update|_update60|abs|add|all|assert|atan2|band|bnot|bor|btn|btnp|bxor|camera|cartdata|cd|circ|circfill|clip|cls|cocreate|color|coresume|cos|costatus|count|cstore|cursor|del|dget|dir|dset|exit|export|extcmd|fget|flip|flr|folder|foreach|fset|help|holdframe|import|info|install_demos|install_games|keyconfig|line|load|ls|map|mapdraw|max|memcpy|memset|menuitem|mget|mid|min|mkdir|mset|music|pairs|pal|palt|peek|pget|poke|print|printh|pset|reboot|rect|rectfill|reload|resume|rnd|run|save|setmetatable|sfx|sget|sgn|shl|shr|shutdown|sin|splore|spr|sqrt|srand|sset|sspr|stat|sub|time|type|yield)\b - name - support.function.lua - - - match - \b(and|or|not)\b - name - keyword.operator.lua - - - match - \(|\)|\;|\+=?|-=?|%=?|#|\*=?|\/=?|\^=?|\[|\]|==?|~=|<=?|>=?|,|\.\.?\.?|(?<!\.)\.{2}(?!\.) - name - keyword.operator.punctuation.lua - - - scopeName - source.p8 - uuid - 93E017CC-6F27-11D9-90EB-000D93589AF7 - - From 28dc3baf202ccfeedf49c6468aa80ac63f9d2b46 Mon Sep 17 00:00:00 2001 From: Adam Norberg Date: Sat, 31 Dec 2022 14:55:54 -0800 Subject: [PATCH 02/10] match data regions and individual sprite nybbles This highlights the data region headers individually, and assigns a separate scope to each individual nybble of the sprite sheet and label, which can then be used to color these with the default Pico-8 palette in the theme. --- PICO-8.sublime-syntax | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/PICO-8.sublime-syntax b/PICO-8.sublime-syntax index 5e75a42..2a88255 100644 --- a/PICO-8.sublime-syntax +++ b/PICO-8.sublime-syntax @@ -8,6 +8,9 @@ file_extensions: scope: source.p8 contexts: main: + - match: '^__gfx__\s*$' + scope: keyword.other.sector + set: sprite - match: '\b(function)\s+([a-zA-Z_.:]+[.:])?([a-zA-Z_]\w*)\s*(\()([^)]*)(\))' scope: meta.function.lua captures: @@ -75,3 +78,50 @@ contexts: scope: keyword.operator.lua - match: '\(|\)|\;|\+=?|-=?|%=?|#|@|$|\*=?|\/=?|\\=?|\^=?|\[|\]|==?|~=|!=|<=?|>=?|,|\.\.?\.?|<<>?|>>>?|>><|(? Date: Sat, 31 Dec 2022 16:43:03 -0800 Subject: [PATCH 03/10] ST3 format; P8ify all colors; color pixels. All colors specified in the Pico-8 scheme are on one of the two Pico-8 palettes. I have named all P8 colors, including the secret palette colors that are not actually used in the scheme, for the convenience of future developers who want to tinker with this. The per-nybble colors for the sprite sheet and label are provided here, matching the highly specific scopes emitted by the syntax. Some redundant scopes were removed. All standard scopes listed in the Sublime Text 3 docs are now provided. --- PICO-8.sublime-color-scheme | 430 ++++++++++++++++++++++ PICO-8.sublime-settings | 2 +- PICO-8.tmTheme | 696 ------------------------------------ 3 files changed, 431 insertions(+), 697 deletions(-) create mode 100644 PICO-8.sublime-color-scheme delete mode 100644 PICO-8.tmTheme diff --git a/PICO-8.sublime-color-scheme b/PICO-8.sublime-color-scheme new file mode 100644 index 0000000..037bd26 --- /dev/null +++ b/PICO-8.sublime-color-scheme @@ -0,0 +1,430 @@ +{ + "name": "PICO-8", + "author": "Unknown", + "variables": + { + "p0x0_black": "#000000", + "p0x1_dkblue": "#1d2b53", + "p0x2_plum": "#7e2553", + "p0x3_dkgreen": "#008751", + "p0x4_brown": "#ab5236", + "p0x5_dkgrey": "#5f574f", + "p0x6_grey": "#c2c3c7", + "p0x7_white": "#fff1e8", + "p0x8_red": "#ff004d", + "p0x9_orange": "#ffa300", + "p0xa_yellow": "#ffec27", + "p0xb_green": "#00e436", + "p0xc_blue": "#29adff", + "p0xd_lavender": "#83769c", + "p0xe_pink": "#ff77a8", + "p0xf_ltpeach": "#ffccaa", + + "p0x80_coffee": "#291814", + "p0x81_navy": "#111D35", + "p0x82_burgundy": "#422136", + "p0x83_teal": "#125359", + "p0x84_camel": "#742f29", + "p0x85_dkmauve": "#49333b", + "p0x86_beige": "#a28879", + "p0x87_canary": "#f3ef7d", + "p0x88_fuchsia": "#be1250", + "p0x89_tangerine": "#ff6c24", + "p0x8a_lime": "#a8e72e", + "p0x8b_grass": "#00b543", + "p0x8c_cobalt": "#065ab5", + "p0x8d_mauve": "#754665", + "p0x8e_salmon": "#ff6e59", + "p0x8f_peach": "#ff9d81", + }, + "globals": + { + "foreground": "var(p0x6_grey)", + "background": "var(p0x1_dkblue)", + "caret": "var(p0x8_red)", + "invisibles": "var(p0x0_black)", + "line_highlight": "var(p0x81_navy)", + "selection": "var(p0xa_yellow)" + }, + "rules": + [ + { + "name": "Pico-8 tab marker", + "scope": "comment.line.pico8.tab", + "foreground": "var(p0x7_white)", + "background": "var(p0x8_red)", + }, + { + "name": "Pico-8 region marker", + "scope": "keyword.other.sector", + "foreground": "var(p0x7_white)", + "background": "var(p0xe_pink)", + }, + { + "name": "Pico-8 pixel 0", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.0", + "foreground": "var(p0x5_dkgrey)", + "background": "var(p0x0_black)", + }, + { + "name": "Pico-8 pixel 1", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.1", + "foreground": "var(p0x8c_cobalt)", + "background": "var(p0x1_dkblue)", + }, + { + "name": "Pico-8 pixel 2", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.2", + "foreground": "var(p0xe_pink)", + "background": "var(p0x2_plum)", + }, + { + "name": "Pico-8 pixel 3", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.3", + "foreground": "var(p0xb_green)", + "background": "var(p0x3_dkgreen)", + }, + { + "name": "Pico-8 pixel 4", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.4", + "foreground": "var(p0x9_orange)", + "background": "var(p0x4_brown)", + }, + { + "name": "Pico-8 pixel 5", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.5", + "foreground": "var(p0x6_grey!)", + "background": "var(p0x5_dkgrey)", + }, + { + "name": "Pico-8 pixel 6", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.6", + "foreground": "var(p0x5_dkgrey)", + "background": "var(p0x6_grey)", + }, + { + "name": "Pico-8 pixel 7", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.7", + "foreground": "var(p0x5_dkgrey)", + "background": "var(p0x7_white)", + }, + { + "name": "Pico-8 pixel 8", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.8", + "foreground": "var(p0xe_pink)", + "background": "var(p0x8_red)", + }, + { + "name": "Pico-8 pixel 9", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.9", + "foreground": "var(p0x0_black)", + "background": "var(p0x9_orange)", + }, + { + "name": "Pico-8 pixel a", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.a", + "foreground": "var(p0x4_brown)", + "background": "var(p0xa_yellow)", + }, + { + "name": "Pico-8 pixel b", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.b", + "foreground": "var(p0x0_black)", + "background": "var(p0xb_green)", + }, + { + "name": "Pico-8 pixel c", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.c", + "foreground": "var(p0x1_dkblue)", + "background": "var(p0xc_blue)", + }, + { + "name": "Pico-8 pixel d", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.d", + "foreground": "var(p0x2_plum)", + "background": "var(p0xd_lavender)", + }, + { + "name": "Pico-8 pixel e", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.e", + "foreground": "var(p0x2_plum)", + "background": "var(p0xe_pink)", + }, + { + "name": "Pico-8 pixel f", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.f", + "foreground": "var(p0x4_brown)", + "background": "var(p0xf_ltpeach)", + }, + { + "name": "Syntax error", + "scope": "invalid", + "background": "var(p0x88_fuchsia)", + "foreground": "var(p0xf_ltpeach)", + }, + { + "name": "Deprecated", + "scope": "invalid.deprecated", + "foreground": "var(p0x9_orange)", + }, + { + "name": "Source", + "scope": "source", + "background": "var(p0x1_dkblue)" + }, + { + "name": "Comment", + "scope": "comment", + "foreground": "var(p0xd_lavender)" + }, + { + "name": "Keyword", + "scope": "keyword, storage", + "foreground": "var(p0xe_pink)" + }, + { + "name": "Keyword operator", + "scope": "keyword.operator.assignment", + "foreground": "var(p0x7_white)" + }, + { + "name": "Keyword operator", + "scope": "keyword.operator.punctuation", + "foreground": "var(p0x7_white)" + }, + { + "name": "keyword like new", + "scope": "keyword.other.special-method", + "foreground": "var(p0xe_pink)" + }, + { + "name": "Function (definition)", + "scope": "entity.name.function, keyword.other.name-of-parameter.objc", + "foreground": "var(p0x6_grey)", + "font_style": "bold" + }, + { + "name": "Section (definition)", + "scope": "entity.name.section", + "foreground": "var(p0x4_brown)", + }, + { + "name": "Class (definition)", + "scope": "entity.name", + "foreground": "var(p0x6_grey)" + }, + { + "name": "Number", + "scope": "constant.numeric", + "foreground": "var(p0xc_blue)" + }, + { + "name": "Assorted constants", + "scope": "constant", + "foreground": "var(p0xc_blue)", + }, + { + "name": "Variable", + "scope": "variable.language, variable.other", + "foreground": "var(p0x6_grey)", + "font_style": "bold" + }, + { + "name": "Built-in constant", + "scope": "constant.language", + "foreground": "var(p0xe_pink)" + }, + { + "name": "String", + "scope": "string", + "foreground": "var(p0xc_blue)" + }, + { + "name": "Inherited class", + "scope": "entity.other.inherited-class", + "foreground": "var(p0x8c_cobalt)" + }, + { + "name": "Inherited class seperator", + "scope": "punctuation.separator.inheritance", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "punctuation block", + "scope": "punctuation.separator.variable", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "array brackets", + "scope": "punctuation.section.array", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "hash separator", + "scope": "punctuation.separator.key-value", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "() brackets", + "scope": "punctuation.section.function, punctuation.definition.parameters", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "hash brackets", + "scope": "punctuation.section.scope", + "foreground": "var(p0x7_white)" + }, + { + "name": "symbol", + "scope": "constant.other.symbol", + "foreground": "var(p0xe_pink)" + }, + { + "name": "Support", + "scope": "support", + "foreground": "var(p0xb_green)", + }, + { + "name": "String.regexp", + "scope": "string.regexp", + "foreground": "var(p0xc_blue)" + }, + { + "name": "String embedded source", + "scope": "string.quoted source", + "foreground": "var(p0xc_blue)" + }, + { + "name": "doctype punctation", + "scope": "meta.tag.sgml.html", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "doctype declaration", + "scope": "entity.name.tag.doctype", + "foreground": "var(p0x6_grey)", + "font_style": "bold" + }, + { + "name": "doctype string", + "scope": "string.quoted.double.doctype", + "foreground": "var(p0xc_blue)", + "font_style": "bold" + }, + { + "name": "html tag punctuation", + "scope": "punctuation.definition.tag", + "foreground": "var(p0xe_pink)" + }, + { + "name": "html tag punctuation", + "scope": "entity.name.tag", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "html attribute", + "scope": "entity.other.attribute-name", + "foreground": "var(p0xc_blue)" + }, + { + "name": "erb tags", + "scope": "punctuation.section.embedded.ruby", + "foreground": "var(p0x6_grey)", + "font_style": "bold" + }, + { + "name": "ruby string interpolation", + "scope": "source.ruby.embedded.source punctuation.section.embedded.ruby", + "foreground": "var(p0x8_red)" + }, + { + "name": "css brackets", + "scope": "punctuation.section.property-list.css", + "foreground": "var(p0x7_white)", + }, + { + "name": "css property", + "scope": "support.type.property-name.css", + "foreground": "var(p0xe_pink)", + "font_style": "bold" + }, + { + "name": "css property punctuation", + "scope": "punctuation.separator.key-value.css", + "foreground": "var(p0x7_white)" + }, + { + "name": "css property value", + "scope": "meta.property-value, constant.other.color", + "foreground": "var(p0xe_pink)" + }, + { + "name": "css ending", + "scope": "punctuation.terminator.rule.css", + "foreground": "var(p0x7_white)" + }, + { + "name": "css font", + "scope": "support.constant.font-name", + "foreground": "var(p0xe_pink)" + }, + { + "name": "css keyword", + "scope": "keyword.other.unit", + "foreground": "var(p0xe_pink)" + }, + { + "name": "pseudo class", + "scope": "entity.other.attribute-name.pseudo-class", + "foreground": "var(p0xd_lavender)" + }, + { + "name": "css constant property value", + "scope": "support.constant.property-value", + "foreground": "var(p0xd_lavender)", + "font_style": "bold" + }, + { + "name": "css attribute class", + "scope": "entity.other.attribute-name.class", + "foreground": "var(p0xc_blue)", + "font_style": "bold" + }, + { + "name": "css attribute id", + "scope": "entity.other.attribute-name.id", + "foreground": "var(p0x8_red)", + "font_style": "bold" + }, + { + "name": "diff header from", + "scope": "meta.diff.header.from-file", + "foreground": "var(p0xf_ltpeach)", + "background": "var(p0x0_black)" + }, + { + "name": "diff header to", + "scope": "meta.diff.header.to-file", + "foreground": "var(p0xf_ltpeach)", + "background": "var(p0x0_black)" + }, + { + "name": "diff inserted", + "scope": "markup.inserted.diff", + "background": "var(p0x80_coffee)", + }, + { + "name": "diff deleted", + "scope": "markup.deleted.diff", + "foreground": "var(p0x88_fuchsia)", + "background": "var(p0x85_dkmauve)", + } + ] +} \ No newline at end of file diff --git a/PICO-8.sublime-settings b/PICO-8.sublime-settings index 5446cdf..cb6f1b8 100644 --- a/PICO-8.sublime-settings +++ b/PICO-8.sublime-settings @@ -1,5 +1,5 @@ { - "color_scheme": "Packages/PICO-8/PICO-8.tmTheme", + "color_scheme": "Packages/PICO-8/PICO-8.sublime-color-scheme", "tab_size": 1, "translate_tabs_to_spaces": true, "detect_indentation": false, diff --git a/PICO-8.tmTheme b/PICO-8.tmTheme deleted file mode 100644 index 207c0e7..0000000 --- a/PICO-8.tmTheme +++ /dev/null @@ -1,696 +0,0 @@ - - - - - name - PICO-8 - settings - - - settings - - background - #1D2B53 - caret - #FF004D - foreground - #C2C3C7 - invisibles - #BFBFBF - lineHighlight - #6F675F - selection - #FFEC27 - - - - name - Source - scope - source - settings - - background - #1D2B53 - - - - name - Comment - scope - comment - settings - - fontStyle - - foreground - #83769C - - - - name - Keyword - scope - keyword, storage - settings - - fontStyle - - foreground - #FF77A8 - - - - name - Keyword operator - scope - keyword.operator.assignment - settings - - fontStyle - - foreground - #FFF1E8 - - - - name - Keyword operator - scope - keyword.operator.punctuation - settings - - fontStyle - - foreground - #FFF1E8 - - - - name - keyword like new - scope - keyword.other.special-method - settings - - fontStyle - - foreground - #FF77A8 - - - - name - Function (definition) - scope - entity.name.function, keyword.other.name-of-parameter.objc - settings - - fontStyle - bold - foreground - #C2C3C7 - - - - name - Class (definition) - scope - entity.name - settings - - fontStyle - - foreground - #C2C3C7 - - - - name - Number - scope - constant.numeric - settings - - fontStyle - - foreground - #29ADFF - - - - name - Variable - scope - variable.language, variable.other - settings - - fontStyle - bold - foreground - #C2C3C7 - - - - name - Built-in constant - scope - constant.language - settings - - fontStyle - - foreground - #FF77A8 - - - - name - Variable - scope - variable.other.constant.ruby - settings - - foreground - #0F8787 - - - - name - Built-in constant - scope - constant.language - settings - - fontStyle - - foreground - #29ADFF - - - - name - String - scope - string - settings - - foreground - #29ADFF - - - - name - Inherited class - scope - entity.other.inherited-class - settings - - fontStyle - - foreground - #0F87FF - - - - name - Inherited class seperator - scope - punctuation.separator.inheritance - settings - - fontStyle - bold - foreground - #FFF1E8 - - - - name - punctuation block - scope - punctuation.separator.variable - settings - - fontStyle - bold - foreground - #FFf1E8 - - - - name - array brackets - scope - punctuation.section.array - settings - - fontStyle - bold - foreground - #FFF1E8 - - - - name - hash separator - scope - punctuation.separator.key-value - settings - - fontStyle - bold - foreground - #FFF1E8 - - - - name - () brackets - scope - punctuation.section.function, punctuation.definition.parameters - settings - - fontStyle - bold - foreground - #FFF1E8 - - - - name - hash brackets - scope - punctuation.section.scope - settings - - fontStyle - - foreground - #FFF1E8 - - - - name - Special ruby method - scope - keyword.other.special-method.ruby - settings - - fontStyle - - - - - name - symbol - scope - constant.other.symbol - settings - - fontStyle - - foreground - #FF77A8 - - - - name - Support class - scope - support.class - settings - - fontStyle - - foreground - #00E756 - - - - name - Support type - scope - support.type - settings - - fontStyle - - foreground - #00E756 - - - - name - Support function - scope - support.function - settings - - fontStyle - - foreground - #00E756 - - - - name - String.regexp - scope - string.regexp - settings - - foreground - #29ADFF - - - - name - String embedded source - scope - string.quoted source - settings - - foreground - #29ADFF - - - - name - doctype punctation - scope - meta.tag.sgml.html - settings - - fontStyle - bold - foreground - #FFF1E8 - - - - name - doctype declaration - scope - entity.name.tag.doctype - settings - - fontStyle - bold - foreground - #999999 - - - - name - doctype string - scope - string.quoted.double.doctype - settings - - fontStyle - bold - foreground - #29ADFF - - - - name - html tag punctuation - scope - punctuation.definition.tag - settings - - fontStyle - - foreground - #FF77A8 - - - - name - html tag punctuation - scope - entity.name.tag - settings - - fontStyle - bold - foreground - #FFF1E8 - - - - name - html attribute - scope - entity.other.attribute-name - settings - - fontStyle - - foreground - #5577BB - - - - name - html attribute punctation - scope - entity.other.attribute-name - settings - - fontStyle - - foreground - #7799CC - - - - name - erb tags - scope - punctuation.section.embedded.ruby - settings - - fontStyle - bold - foreground - #999999 - - - - name - ruby string interpolation - scope - source.ruby.embedded.source punctuation.section.embedded.ruby - settings - - foreground - #CF1040 - - - - name - css brackets - scope - punctuation.section.property-list.css - settings - - fontStyle - - - - - name - css property - scope - support.type.property-name.css - settings - - fontStyle - bold - foreground - #994488 - - - - name - css property punctuation - scope - punctuation.separator.key-value.css - settings - - fontStyle - - foreground - #555555 - - - - name - css property value - scope - meta.property-value, constant.other.color - settings - - fontStyle - - foreground - #FF77A8 - - - - name - css ending - scope - punctuation.terminator.rule.css - settings - - fontStyle - - foreground - #555555 - - - - name - css font - scope - support.constant.font-name - settings - - fontStyle - - foreground - #FF77A8 - - - - name - css keyword - scope - keyword.other.unit - settings - - fontStyle - - foreground - #FF77A8 - - - - name - pseudo class - scope - entity.other.attribute-name.pseudo-class - settings - - fontStyle - - foreground - #8855CC - - - - name - css constant property value - scope - support.constant.property-value - settings - - fontStyle - bold - foreground - #8855CC - - - - name - css attribute class - scope - entity.other.attribute-name.class - settings - - fontStyle - bold - foreground - #3366CC - - - - name - css attribute id - scope - entity.other.attribute-name.id - settings - - fontStyle - bold - foreground - #990000 - - - - name - diff header from - scope - meta.diff.header.from-file - settings - - background - #FFDDDD - fontStyle - - foreground - #555555 - - - - name - diff header to - scope - meta.diff.header.to-file - settings - - background - #DDFFDD - fontStyle - - foreground - #555555 - - - - name - diff inserted - scope - markup.inserted.diff - settings - - background - #DDFFDD - fontStyle - - - - - name - diff deleted - scope - markup.deleted.diff - settings - - background - #FFDDDD - fontStyle - - foreground - #555555 - - - - uuid - 26786979-843B-4FE2-BCB6-4FCEC6F8FB58 - - From beacd32429c18f4ddb4d988f3d16064d095f4c39 Mon Sep 17 00:00:00 2001 From: Adam Norberg Date: Sat, 31 Dec 2022 16:54:17 -0800 Subject: [PATCH 04/10] Add update message. --- messages.json | 3 ++- messages/2022.12.31.txt | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 messages/2022.12.31.txt diff --git a/messages.json b/messages.json index 5dc045a..e44e5e6 100644 --- a/messages.json +++ b/messages.json @@ -2,5 +2,6 @@ "install": "messages/install.txt", "2016.6.30": "messages/2016.6.30.txt", "2016.7.1": "messages/2016.7.1.txt", - "2017.3.14": "messages/2017.3.14.txt" + "2017.3.14": "messages/2017.3.14.txt", + "2022.12.31": "messages/2022.12.31.txt", } diff --git a/messages/2022.12.31.txt b/messages/2022.12.31.txt new file mode 100644 index 0000000..a094a6a --- /dev/null +++ b/messages/2022.12.31.txt @@ -0,0 +1,18 @@ +Sublime PICO-8 v2022.12.31 + +Pico-8 syntax highlighting and the Pico-8 color scheme now use Sublime Text 3 format. + +Syntax highlighting is now updated to match Pico-8 0.2.25e, including using the blue background. Additionally, comments to break code into tabs in the Pico-8 editor are highlighted (using the colors of the P8 editor tab bar), as are markers between segments in the .p8 file. Finally, the __gfx__ segment (the sprite sheet) and the __label__ segment (the cartridge label) are colored character-by-character to match the Pico-8 palette, so the sprite sheet can be (sort of) viewed in Sublime Text! + +A gray variant of the color scheme is available; you can specify this in your Pico-8 user settings: +"color_scheme": "Packages/PICO-8/PICO-8.sublime-color-scheme" + +The color schemes can also be used for Sublime Text in general if you want a Pico-8 feel to all your work! + +Changelog +========= + +- removed: TextMate theme and syntax files +- added: Sublime Text 3 theme and syntax files +- added: section headers and code tab comments are highlighted +- added: individual pixels of the sprite sheet and label are colored to match the P8 palette, making the sprites visible From eb471dc3bc1b4210926d27354853967c80c1ceca Mon Sep 17 00:00:00 2001 From: Adam Norberg Date: Sat, 31 Dec 2022 16:56:52 -0800 Subject: [PATCH 05/10] Set author. Add grey theme. The only difference between PICO-8 and PICO-8 Grey is the background and line highlight color (0x5 and 0x85 respectively). --- PICO-8-Grey.sublime-color-scheme | 430 +++++++++++++++++++++++++++++++ PICO-8.sublime-color-scheme | 2 +- 2 files changed, 431 insertions(+), 1 deletion(-) create mode 100644 PICO-8-Grey.sublime-color-scheme diff --git a/PICO-8-Grey.sublime-color-scheme b/PICO-8-Grey.sublime-color-scheme new file mode 100644 index 0000000..49c2eb0 --- /dev/null +++ b/PICO-8-Grey.sublime-color-scheme @@ -0,0 +1,430 @@ +{ + "name": "PICO-8", + "author": "zep and the PICO-8 community", + "variables": + { + "p0x0_black": "#000000", + "p0x1_dkblue": "#1d2b53", + "p0x2_plum": "#7e2553", + "p0x3_dkgreen": "#008751", + "p0x4_brown": "#ab5236", + "p0x5_dkgrey": "#5f574f", + "p0x6_grey": "#c2c3c7", + "p0x7_white": "#fff1e8", + "p0x8_red": "#ff004d", + "p0x9_orange": "#ffa300", + "p0xa_yellow": "#ffec27", + "p0xb_green": "#00e436", + "p0xc_blue": "#29adff", + "p0xd_lavender": "#83769c", + "p0xe_pink": "#ff77a8", + "p0xf_ltpeach": "#ffccaa", + + "p0x80_coffee": "#291814", + "p0x81_navy": "#111D35", + "p0x82_burgundy": "#422136", + "p0x83_teal": "#125359", + "p0x84_camel": "#742f29", + "p0x85_dkmauve": "#49333b", + "p0x86_beige": "#a28879", + "p0x87_canary": "#f3ef7d", + "p0x88_fuchsia": "#be1250", + "p0x89_tangerine": "#ff6c24", + "p0x8a_lime": "#a8e72e", + "p0x8b_grass": "#00b543", + "p0x8c_cobalt": "#065ab5", + "p0x8d_mauve": "#754665", + "p0x8e_salmon": "#ff6e59", + "p0x8f_peach": "#ff9d81", + }, + "globals": + { + "foreground": "var(p0x6_grey)", + "background": "var(p0x5_dkgrey)", + "caret": "var(p0x8_red)", + "invisibles": "var(p0x0_black)", + "line_highlight": "var(p0x85_dkmauve)", + "selection": "var(p0xa_yellow)" + }, + "rules": + [ + { + "name": "Pico-8 tab marker", + "scope": "comment.line.pico8.tab", + "foreground": "var(p0x7_white)", + "background": "var(p0x8_red)", + }, + { + "name": "Pico-8 region marker", + "scope": "keyword.other.sector", + "foreground": "var(p0x7_white)", + "background": "var(p0xe_pink)", + }, + { + "name": "Pico-8 pixel 0", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.0", + "foreground": "var(p0x5_dkgrey)", + "background": "var(p0x0_black)", + }, + { + "name": "Pico-8 pixel 1", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.1", + "foreground": "var(p0x8c_cobalt)", + "background": "var(p0x1_dkblue)", + }, + { + "name": "Pico-8 pixel 2", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.2", + "foreground": "var(p0xe_pink)", + "background": "var(p0x2_plum)", + }, + { + "name": "Pico-8 pixel 3", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.3", + "foreground": "var(p0xb_green)", + "background": "var(p0x3_dkgreen)", + }, + { + "name": "Pico-8 pixel 4", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.4", + "foreground": "var(p0x9_orange)", + "background": "var(p0x4_brown)", + }, + { + "name": "Pico-8 pixel 5", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.5", + "foreground": "var(p0x6_grey!)", + "background": "var(p0x5_dkgrey)", + }, + { + "name": "Pico-8 pixel 6", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.6", + "foreground": "var(p0x5_dkgrey)", + "background": "var(p0x6_grey)", + }, + { + "name": "Pico-8 pixel 7", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.7", + "foreground": "var(p0x5_dkgrey)", + "background": "var(p0x7_white)", + }, + { + "name": "Pico-8 pixel 8", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.8", + "foreground": "var(p0xe_pink)", + "background": "var(p0x8_red)", + }, + { + "name": "Pico-8 pixel 9", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.9", + "foreground": "var(p0x0_black)", + "background": "var(p0x9_orange)", + }, + { + "name": "Pico-8 pixel a", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.a", + "foreground": "var(p0x4_brown)", + "background": "var(p0xa_yellow)", + }, + { + "name": "Pico-8 pixel b", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.b", + "foreground": "var(p0x0_black)", + "background": "var(p0xb_green)", + }, + { + "name": "Pico-8 pixel c", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.c", + "foreground": "var(p0x1_dkblue)", + "background": "var(p0xc_blue)", + }, + { + "name": "Pico-8 pixel d", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.d", + "foreground": "var(p0x2_plum)", + "background": "var(p0xd_lavender)", + }, + { + "name": "Pico-8 pixel e", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.e", + "foreground": "var(p0x2_plum)", + "background": "var(p0xe_pink)", + }, + { + "name": "Pico-8 pixel f", + "scope": "constant.numeric.integer.hexadecimal.lua.pico8.color.f", + "foreground": "var(p0x4_brown)", + "background": "var(p0xf_ltpeach)", + }, + { + "name": "Syntax error", + "scope": "invalid", + "background": "var(p0x88_fuchsia)", + "foreground": "var(p0xf_ltpeach)", + }, + { + "name": "Deprecated", + "scope": "invalid.deprecated", + "foreground": "var(p0x9_orange)", + }, + { + "name": "Source", + "scope": "source", + "background": "var(p0x1_dkblue)" + }, + { + "name": "Comment", + "scope": "comment", + "foreground": "var(p0xd_lavender)" + }, + { + "name": "Keyword", + "scope": "keyword, storage", + "foreground": "var(p0xe_pink)" + }, + { + "name": "Keyword operator", + "scope": "keyword.operator.assignment", + "foreground": "var(p0x7_white)" + }, + { + "name": "Keyword operator", + "scope": "keyword.operator.punctuation", + "foreground": "var(p0x7_white)" + }, + { + "name": "keyword like new", + "scope": "keyword.other.special-method", + "foreground": "var(p0xe_pink)" + }, + { + "name": "Function (definition)", + "scope": "entity.name.function, keyword.other.name-of-parameter.objc", + "foreground": "var(p0x6_grey)", + "font_style": "bold" + }, + { + "name": "Section (definition)", + "scope": "entity.name.section", + "foreground": "var(p0x4_brown)", + }, + { + "name": "Class (definition)", + "scope": "entity.name", + "foreground": "var(p0x6_grey)" + }, + { + "name": "Number", + "scope": "constant.numeric", + "foreground": "var(p0xc_blue)" + }, + { + "name": "Assorted constants", + "scope": "constant", + "foreground": "var(p0xc_blue)", + }, + { + "name": "Variable", + "scope": "variable.language, variable.other", + "foreground": "var(p0x6_grey)", + "font_style": "bold" + }, + { + "name": "Built-in constant", + "scope": "constant.language", + "foreground": "var(p0xe_pink)" + }, + { + "name": "String", + "scope": "string", + "foreground": "var(p0xc_blue)" + }, + { + "name": "Inherited class", + "scope": "entity.other.inherited-class", + "foreground": "var(p0x8c_cobalt)" + }, + { + "name": "Inherited class seperator", + "scope": "punctuation.separator.inheritance", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "punctuation block", + "scope": "punctuation.separator.variable", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "array brackets", + "scope": "punctuation.section.array", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "hash separator", + "scope": "punctuation.separator.key-value", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "() brackets", + "scope": "punctuation.section.function, punctuation.definition.parameters", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "hash brackets", + "scope": "punctuation.section.scope", + "foreground": "var(p0x7_white)" + }, + { + "name": "symbol", + "scope": "constant.other.symbol", + "foreground": "var(p0xe_pink)" + }, + { + "name": "Support", + "scope": "support", + "foreground": "var(p0xb_green)", + }, + { + "name": "String.regexp", + "scope": "string.regexp", + "foreground": "var(p0xc_blue)" + }, + { + "name": "String embedded source", + "scope": "string.quoted source", + "foreground": "var(p0xc_blue)" + }, + { + "name": "doctype punctation", + "scope": "meta.tag.sgml.html", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "doctype declaration", + "scope": "entity.name.tag.doctype", + "foreground": "var(p0x6_grey)", + "font_style": "bold" + }, + { + "name": "doctype string", + "scope": "string.quoted.double.doctype", + "foreground": "var(p0xc_blue)", + "font_style": "bold" + }, + { + "name": "html tag punctuation", + "scope": "punctuation.definition.tag", + "foreground": "var(p0xe_pink)" + }, + { + "name": "html tag punctuation", + "scope": "entity.name.tag", + "foreground": "var(p0x7_white)", + "font_style": "bold" + }, + { + "name": "html attribute", + "scope": "entity.other.attribute-name", + "foreground": "var(p0xc_blue)" + }, + { + "name": "erb tags", + "scope": "punctuation.section.embedded.ruby", + "foreground": "var(p0x6_grey)", + "font_style": "bold" + }, + { + "name": "ruby string interpolation", + "scope": "source.ruby.embedded.source punctuation.section.embedded.ruby", + "foreground": "var(p0x8_red)" + }, + { + "name": "css brackets", + "scope": "punctuation.section.property-list.css", + "foreground": "var(p0x7_white)", + }, + { + "name": "css property", + "scope": "support.type.property-name.css", + "foreground": "var(p0xe_pink)", + "font_style": "bold" + }, + { + "name": "css property punctuation", + "scope": "punctuation.separator.key-value.css", + "foreground": "var(p0x7_white)" + }, + { + "name": "css property value", + "scope": "meta.property-value, constant.other.color", + "foreground": "var(p0xe_pink)" + }, + { + "name": "css ending", + "scope": "punctuation.terminator.rule.css", + "foreground": "var(p0x7_white)" + }, + { + "name": "css font", + "scope": "support.constant.font-name", + "foreground": "var(p0xe_pink)" + }, + { + "name": "css keyword", + "scope": "keyword.other.unit", + "foreground": "var(p0xe_pink)" + }, + { + "name": "pseudo class", + "scope": "entity.other.attribute-name.pseudo-class", + "foreground": "var(p0xd_lavender)" + }, + { + "name": "css constant property value", + "scope": "support.constant.property-value", + "foreground": "var(p0xd_lavender)", + "font_style": "bold" + }, + { + "name": "css attribute class", + "scope": "entity.other.attribute-name.class", + "foreground": "var(p0xc_blue)", + "font_style": "bold" + }, + { + "name": "css attribute id", + "scope": "entity.other.attribute-name.id", + "foreground": "var(p0x8_red)", + "font_style": "bold" + }, + { + "name": "diff header from", + "scope": "meta.diff.header.from-file", + "foreground": "var(p0xf_ltpeach)", + "background": "var(p0x0_black)" + }, + { + "name": "diff header to", + "scope": "meta.diff.header.to-file", + "foreground": "var(p0xf_ltpeach)", + "background": "var(p0x0_black)" + }, + { + "name": "diff inserted", + "scope": "markup.inserted.diff", + "background": "var(p0x80_coffee)", + }, + { + "name": "diff deleted", + "scope": "markup.deleted.diff", + "foreground": "var(p0x88_fuchsia)", + "background": "var(p0x85_dkmauve)", + } + ] +} \ No newline at end of file diff --git a/PICO-8.sublime-color-scheme b/PICO-8.sublime-color-scheme index 037bd26..1e7f17f 100644 --- a/PICO-8.sublime-color-scheme +++ b/PICO-8.sublime-color-scheme @@ -1,6 +1,6 @@ { "name": "PICO-8", - "author": "Unknown", + "author": "zep and the PICO-8 community", "variables": { "p0x0_black": "#000000", From 2bf9799728fc5d850a415c7bcf0da6433277a95b Mon Sep 17 00:00:00 2001 From: Adam Norberg Date: Sat, 31 Dec 2022 17:01:08 -0800 Subject: [PATCH 06/10] update README Also mentions the syntax highlighting change in the version update message. --- README.md | 8 ++++++++ messages/2022.12.31.txt | 1 + 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 6a85587..fa1cd60 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This package includes: - `.p8` language definition (by [Overkill](http://www.lexaloffle.com/bbs/?uid=11331)). - Syntax highlighting (by [Overkill](http://www.lexaloffle.com/bbs/?uid=11331)). +- Sprite sheet syntax highlighting (by [Adam Norberg](https://github.com/AdamNorberg)). - PICO-8 `.ttf` font (by [RhythmLynx](http://www.lexaloffle.com/bbs/?uid=11704)). - Cartridge runner to launch your cart right from Sublime Text. - Code completion based on the official [PICO-8 API](http://neko250.github.io/pico8-api/). @@ -93,6 +94,13 @@ __IMPORTANT__: Remember using the escape character for the backslash (`\\`) inst ## Version History +- __v2022.12.31__: + - `changed`: syntax highlighting updated for Pico-8 0.2.25e + - `removed`: TextMate theme and syntax files + - `added`: Sublime Text 3 theme and syntax files + - `added`: section headers and code tab comments are highlighted + - `added`: individual pixels of the sprite sheet and label are colored to match the P8 palette, making the sprites visible + - __v2017.3.14__: - `added`: automatically lowercase the file upon saving. - `added`: `extcmd` function (syntax and autocomplete). diff --git a/messages/2022.12.31.txt b/messages/2022.12.31.txt index a094a6a..3bb4aff 100644 --- a/messages/2022.12.31.txt +++ b/messages/2022.12.31.txt @@ -12,6 +12,7 @@ The color schemes can also be used for Sublime Text in general if you want a Pic Changelog ========= +- changed: syntax highlighting updated for Pico-8 0.2.25e - removed: TextMate theme and syntax files - added: Sublime Text 3 theme and syntax files - added: section headers and code tab comments are highlighted From 2c3c1f7349e1801dcfed1403f74ff62cda89e78e Mon Sep 17 00:00:00 2001 From: Adam Norberg Date: Sat, 31 Dec 2022 17:08:47 -0800 Subject: [PATCH 07/10] Debugging Fix Grey background, actually highlight tabs --- PICO-8-Grey.sublime-color-scheme | 2 +- PICO-8.sublime-syntax | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/PICO-8-Grey.sublime-color-scheme b/PICO-8-Grey.sublime-color-scheme index 49c2eb0..0065723 100644 --- a/PICO-8-Grey.sublime-color-scheme +++ b/PICO-8-Grey.sublime-color-scheme @@ -170,7 +170,7 @@ { "name": "Source", "scope": "source", - "background": "var(p0x1_dkblue)" + "background": "var(p0x5_dkgrey)" }, { "name": "Comment", diff --git a/PICO-8.sublime-syntax b/PICO-8.sublime-syntax index 2a88255..8f188e7 100644 --- a/PICO-8.sublime-syntax +++ b/PICO-8.sublime-syntax @@ -11,6 +11,8 @@ contexts: - match: '^__gfx__\s*$' scope: keyword.other.sector set: sprite + - match: '^-->8\s*$' + scope: comment.line.pico8.tab - match: '\b(function)\s+([a-zA-Z_.:]+[.:])?([a-zA-Z_]\w*)\s*(\()([^)]*)(\))' scope: meta.function.lua captures: From 24b2fdc0e56126bbdbf9af6a6ac9837c968ab42f Mon Sep 17 00:00:00 2001 From: Adam Norberg Date: Sat, 31 Dec 2022 17:18:46 -0800 Subject: [PATCH 08/10] Also mark the __lua__ segment. --- PICO-8.sublime-syntax | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PICO-8.sublime-syntax b/PICO-8.sublime-syntax index 8f188e7..927b0db 100644 --- a/PICO-8.sublime-syntax +++ b/PICO-8.sublime-syntax @@ -11,6 +11,8 @@ contexts: - match: '^__gfx__\s*$' scope: keyword.other.sector set: sprite + - match: '^__lua__\s*$' + scope: keyword.other.sector - match: '^-->8\s*$' scope: comment.line.pico8.tab - match: '\b(function)\s+([a-zA-Z_.:]+[.:])?([a-zA-Z_]\w*)\s*(\()([^)]*)(\))' From 65006f570ca5839c557864405f11dbeb68b93a62 Mon Sep 17 00:00:00 2001 From: Adam Norberg Date: Sat, 31 Dec 2022 17:48:07 -0800 Subject: [PATCH 09/10] Fix character escapes. Adopts patch in issue #9. Closes #9. --- PICO-8.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PICO-8.sublime-syntax b/PICO-8.sublime-syntax index 927b0db..a5ab4ff 100644 --- a/PICO-8.sublime-syntax +++ b/PICO-8.sublime-syntax @@ -46,7 +46,7 @@ contexts: captures: 0: punctuation.definition.string.end.lua pop: true - - match: \\. + - match: "\\([abfnrtv\"']|\\r?\\n|\\n\\r?|\\d\\d?\\d?|[xX][0-9a-fA-F]{2})" scope: constant.character.escape.lua - match: '(?