Skip to content

Instantly share code, notes, and snippets.

@peterhellberg
Last active October 1, 2024 13:06
Show Gist options
  • Select an option

  • Save peterhellberg/ede98dd3bd1947046cba812524cc0d17 to your computer and use it in GitHub Desktop.

Select an option

Save peterhellberg/ede98dd3bd1947046cba812524cc0d17 to your computer and use it in GitHub Desktop.
Making GtkSourceView based apps looks slightly better under Pop!_OS

pop-dark.xml

Screenshot from 2024-10-01 13-54-01

<?xml version="1.0" encoding="UTF-8"?>
<style-scheme id="pop-dark" name="Pop! - Dark" version="1.0">
  <author>Peter Hellberg</author>
  <_description>Pop! based on Coldark color scheme.</_description>

  <!-- Pop! colors -->
  <color name="pop00" value="#211F1F"/>
  <color name="pop01" value="#363636"/>
  <color name="pop02" value="#323232"/>
  <color name="pop03" value="#605958"/>
  <color name="pop04" value="#d0dae7"/>
  <color name="pop05" value="#E8E8D3"/>
  <color name="pop06" value="#f0f4f8"/>
  <color name="pop07" value="#211F1F"/>
  <color name="pop08" value="#C6B6EE"/>
  <color name="pop09" value="#CF6A4C"/>
  <color name="pop10" value="#FFB964"/>
  <color name="pop11" value="#99AD6A"/>
  <color name="pop12" value="#aec98d"/>
  <color name="pop13" value="#FAD07A"/>
  <color name="pop14" value="#8FBFDC"/>
  <color name="pop15" value="#cd6660"/>

  <!-- Global Settings -->
  <style name="text" foreground="pop05" background="pop00"/>
  <style name="selection" foreground="pop05" background="pop02" />
  <style name="selection-unfocused" foreground="pop05" background="pop02" />
  <style name="cursor" foreground="pop05" />
  <style name="secondary-cursor" foreground="pop05" />
  <style name="current-line" background="pop01" />
  <style name="line-numbers" foreground="pop03" background="pop07" />
  <style name="current-line-number" background="pop02" />
  <style name="bracket-match" foreground="pop10" background="pop02" />
  <style name="bracket-mismatch" foreground="pop15" background="pop02" />
  <style name="right-margin" foreground="pop05" background="pop00" />
  <style name="draw-spaces" foreground="pop02" />
  <style name="background-pattern" background="pop07" />

  <!-- Comments -->
  <style name="def:comment" foreground="pop03" />
  <style name="def:shebang" foreground="pop08" />
  <style name="def:doc-comment" foreground="pop11" />
  <style name="def:doc-comment-element" foreground="pop14" />

  <!-- Constants -->
  <style name="def:constant" foreground="pop10" />
  <style name="def:character" foreground="pop12" />
  <style name="def:string" foreground="pop11" />
  <style name="def:special-char" foreground="pop12" />
  <style name="def:number" foreground="pop09" />
  <style name="def:floating-point" foreground="pop09" />
  <style name="def:decimal" foreground="pop09" />
  <style name="def:base-n-integer" foreground="pop09" />
  <style name="def:complex" foreground="pop09" />
  <style name="def:special-constant" foreground="pop09" />
  <style name="def:boolean" foreground="pop09" />

  <!-- Variables -->
  <style name="def:identifier" foreground="pop10" />

  <!-- Functions -->
  <style name="def:function" foreground="pop13" />

  <!-- Builtin -->
  <style name="def:builtin" foreground="pop12" />

  <!-- Statements -->
  <style name="def:statement" foreground="pop12" />
  <style name="def:operator" foreground="pop14" />
  <style name="def:keyword" foreground="pop14" />

  <!-- Types -->
  <style name="def:type" foreground="pop14" />

  <!-- Others -->
  <style name="def:preprocessor" foreground="pop14" />
  <style name="def:error" foreground="pop15" />
  <style name="def:warning" foreground="pop14" />
  <style name="def:reserved" foreground="#FF0000" /> <!--Reserved keywords: like "const" and "goto" in Java -->
  <style name="def:note" foreground="pop14" bold="true" />
  <style name="def:underlined" underline="single" />

  <!-- LANGUAGES -->
  <!-- CSS -->
  <style name="css:vendor-specific" foreground="pop14" />
  <style name="css:keyword" foreground="pop12" />
  <style name="css:symbol" foreground="pop08" />
  <style name="css:delimiter" foreground="pop05" />
  <style name="css:color" foreground="pop11" />
  <style name="css:function" foreground="pop12" />
  <style name="css:property-name" foreground="pop10" />
  <style name="css:modifier" foreground="pop14" />
  <style name="css:selector-symbol" foreground="pop14" />
  <style name="css:id-selector" foreground="pop13" />
  <style name="css:class-selector" foreground="pop13" />
  <style name="css:type-selector" foreground="pop08" />
  <style name="css:universal-selector" foreground="pop08" />
  <style name="css:attribute-selector" foreground="pop05" />
  <style name="css:attribute-selector-name" foreground="pop09" />
  <style name="css:pseudo-element" foreground="pop14" />
  <style name="css:pseudo-class" foreground="pop14" />

  <!-- Diff -->
  <style name="diff:added-line" foreground="pop11" />
  <style name="diff:removed-line" foreground="pop15" />
  <style name="diff:changed-line" foreground="pop09" />
  <style name="diff:location" foreground="pop13" />
  <style name="diff:diff-file" foreground="pop10" />

  <!-- Javascript -->
  <style name="javascript:function" foreground="pop13" />
  <style name="javascript:regex" foreground="pop12" />

  <!-- Makefile -->
  <style name="makefile:assignment-rhs" foreground="pop11" />
  <style name="makefile:assignment-lhs" foreground="pop10" />
  <style name="makefile:prereq" foreground="pop14" />
  <style name="makefile:command" foreground="pop08" />

  <!-- Markdown -->
  <style name="markdown:header" foreground="pop10" bold="true" />
  <style name="markdown:horizontal-rule" foreground="pop10" />
  <style name="markdown:code" foreground="pop14" />
  <style name="markdown:blockquote-marker" foreground="pop12" />
  <style name="markdown:url" foreground="pop09" />
  <style name="markdown:link-text" foreground="pop11" />
  <style name="markdown:label" foreground="pop10" />
  <style name="markdown:attribute-value" foreground="pop11" />
  <style name="markdown:image-marker" foreground="pop05" />
  <style name="markdown:emphasis" foreground="pop05" italic="true" />
  <style name="markdown:strong-emphasis" foreground="pop05" bold="true" />

  <!-- PHP -->
  <style name="php:variable" foreground="pop10" />
  <style name="php:identifier" foreground="pop12" />
  <style name="php:type" foreground="pop12" />

  <!-- Python -->
  <style name="python:string-conversion" foreground="#FF0000" />
  <style name="python:builtin-object" foreground="pop12" />
  <style name="python:class-name" foreground="pop10" />
  <style name="python:decorator" foreground="pop12" />

  <!-- Rust -->
  <style name="rust:scope" foreground="pop12" />
  <style name="rust:attribute" foreground="pop08" />
  <style name="rust:macro" foreground="pop12" />

  <!-- SH -->
  <style name="sh:variable" foreground="pop10" />
  <style name="sh:common-command" foreground="pop12" />

  <!-- TOML -->
  <style name="toml:variable" foreground="pop10" />
  <style name="toml:datetime-value" foreground="pop12" />

  <!-- XML -->
  <style name="xml:doctype" foreground="pop08" />
  <style name="xml:cdata-delim" foreground="#FF0000" />
  <style name="xml:processing-instruction" foreground="pop08" />
  <style name="xml:element-name" foreground="pop08" />
  <style name="xml:attribute-name" foreground="pop09" />
  <style name="xml:attribute-value" foreground="pop11" />

  <!-- YAML -->
  <style name="yaml:map-key" foreground="pop10" />
</style-scheme>

Slightly higher contrast with <color name="pop00" value="#151515"/>

Screenshot from 2024-10-01 15-01-22

Links

Details https://github.com/ArmandPhilippot/coldark-gtksourceview/ Theme:
coldark-dark.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--

 This file is part of GtkSourceView

 Copyright (C) 2020 Armand Philippot
 Author: Armand Philippot <contact@armandphilippot.com>

 GtkSourceView is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 GtkSourceView is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

-->
<style-scheme id="coldark-dark" name="Coldark - Dark" version="1.0">
  <author>Armand Philippot</author>
  <_description>Coldark color scheme - A grey-blue theme for web development.</_description>

  <!-- Coldark colors -->
  <color name="coldark00" value="#111b27"/>
  <color name="coldark01" value="#213043"/>
  <color name="coldark02" value="#3c526d"/>
  <color name="coldark03" value="#8da1b9"/>
  <color name="coldark04" value="#d0dae7"/>
  <color name="coldark05" value="#e3eaf2"/>
  <color name="coldark06" value="#f0f4f8"/>
  <color name="coldark07" value="#0b121b"/>
  <color name="coldark08" value="#66cccc"/>
  <color name="coldark09" value="#e6d37a"/>
  <color name="coldark10" value="#6cb8e6"/>
  <color name="coldark11" value="#91d076"/>
  <color name="coldark12" value="#f4adf4"/>
  <color name="coldark13" value="#c699e3"/>
  <color name="coldark14" value="#e9ae7e"/>
  <color name="coldark15" value="#cd6660"/>

  <!-- Global Settings -->
  <style name="text" foreground="coldark05" background="coldark00"/>
  <style name="selection" foreground="coldark05" background="coldark02" />
  <style name="selection-unfocused" foreground="coldark03" background="coldark02" />
  <style name="cursor" foreground="coldark05" />
  <style name="secondary-cursor" foreground="coldark05" />
  <style name="current-line" background="coldark01" />
  <style name="line-numbers" foreground="coldark03" background="coldark07" />
  <style name="current-line-number" background="coldark01" />
  <style name="bracket-match" foreground="coldark10" background="coldark02" />
  <style name="bracket-mismatch" foreground="coldark15" background="coldark02" />
  <style name="right-margin" foreground="coldark05" background="coldark00" />
  <style name="draw-spaces" foreground="coldark02" />
  <style name="background-pattern" background="coldark07" />

  <!-- Comments -->
  <style name="def:comment" foreground="coldark03" />
  <style name="def:shebang" foreground="coldark08" />
  <style name="def:doc-comment" foreground="coldark11" />
  <style name="def:doc-comment-element" foreground="coldark14" />

  <!-- Constants -->
  <style name="def:constant" foreground="coldark10" />
  <style name="def:character" foreground="coldark12" />
  <style name="def:string" foreground="coldark11" />
  <style name="def:special-char" foreground="coldark12" />
  <style name="def:number" foreground="coldark09" />
  <style name="def:floating-point" foreground="coldark09" />
  <style name="def:decimal" foreground="coldark09" />
  <style name="def:base-n-integer" foreground="coldark09" />
  <style name="def:complex" foreground="coldark09" />
  <style name="def:special-constant" foreground="coldark09" />
  <style name="def:boolean" foreground="coldark09" />

  <!-- Variables -->
  <style name="def:identifier" foreground="coldark10" />

  <!-- Functions -->
  <style name="def:function" foreground="coldark13" />

  <!-- Builtin -->
  <style name="def:builtin" foreground="coldark12" />

  <!-- Statements -->
  <style name="def:statement" foreground="coldark12" />
  <style name="def:operator" foreground="coldark14" />
  <style name="def:keyword" foreground="coldark14" />

  <!-- Types -->
  <style name="def:type" foreground="coldark14" />

  <!-- Others -->
  <style name="def:preprocessor" foreground="coldark14" />
  <style name="def:error" foreground="coldark15" />
  <style name="def:warning" foreground="coldark14" />
  <style name="def:reserved" foreground="#FF0000" /> <!--Reserved keywords: like "const" and "goto" in Java -->
  <style name="def:note" foreground="coldark14" bold="true" />
  <style name="def:underlined" underline="single" />

  <!-- LANGUAGES -->
  <!-- CSS -->
  <style name="css:vendor-specific" foreground="coldark14" />
  <style name="css:keyword" foreground="coldark12" />
  <style name="css:symbol" foreground="coldark08" />
  <style name="css:delimiter" foreground="coldark05" />
  <style name="css:color" foreground="coldark11" />
  <style name="css:function" foreground="coldark12" />
  <style name="css:property-name" foreground="coldark10" />
  <style name="css:modifier" foreground="coldark14" />
  <style name="css:selector-symbol" foreground="coldark14" />
  <style name="css:id-selector" foreground="coldark13" />
  <style name="css:class-selector" foreground="coldark13" />
  <style name="css:type-selector" foreground="coldark08" />
  <style name="css:universal-selector" foreground="coldark08" />
  <style name="css:attribute-selector" foreground="coldark05" />
  <style name="css:attribute-selector-name" foreground="coldark09" />
  <style name="css:pseudo-element" foreground="coldark14" />
  <style name="css:pseudo-class" foreground="coldark14" />

  <!-- Diff -->
  <style name="diff:added-line" foreground="coldark11" />
  <style name="diff:removed-line" foreground="coldark15" />
  <style name="diff:changed-line" foreground="coldark09" />
  <style name="diff:location" foreground="coldark13" />
  <style name="diff:diff-file" foreground="coldark10" />

  <!-- Javascript -->
  <style name="javascript:function" foreground="coldark13" />
  <style name="javascript:regex" foreground="coldark12" />

  <!-- Makefile -->
  <style name="makefile:assignment-rhs" foreground="coldark11" />
  <style name="makefile:assignment-lhs" foreground="coldark10" />
  <style name="makefile:prereq" foreground="coldark14" />
  <style name="makefile:command" foreground="coldark08" />

  <!-- Markdown -->
  <style name="markdown:header" foreground="coldark10" bold="true" />
  <style name="markdown:horizontal-rule" foreground="coldark10" />
  <style name="markdown:code" foreground="coldark14" />
  <style name="markdown:blockquote-marker" foreground="coldark12" />
  <style name="markdown:url" foreground="coldark09" />
  <style name="markdown:link-text" foreground="coldark11" />
  <style name="markdown:label" foreground="coldark10" />
  <style name="markdown:attribute-value" foreground="coldark11" />
  <style name="markdown:image-marker" foreground="coldark05" />
  <style name="markdown:emphasis" foreground="coldark05" italic="true" />
  <style name="markdown:strong-emphasis" foreground="coldark05" bold="true" />

  <!-- PHP -->
  <style name="php:variable" foreground="coldark10" />
  <style name="php:identifier" foreground="coldark12" />
  <style name="php:type" foreground="coldark12" />

  <!-- Python -->
  <style name="python:string-conversion" foreground="#FF0000" />
  <style name="python:builtin-object" foreground="coldark12" />
  <style name="python:class-name" foreground="coldark10" />
  <style name="python:decorator" foreground="coldark12" />

  <!-- Rust -->
  <style name="rust:scope" foreground="coldark12" />
  <style name="rust:attribute" foreground="coldark08" />
  <style name="rust:macro" foreground="coldark12" />

  <!-- SH -->
  <style name="sh:variable" foreground="coldark10" />
  <style name="sh:common-command" foreground="coldark12" />

  <!-- TOML -->
  <style name="toml:variable" foreground="coldark10" />
  <style name="toml:datetime-value" foreground="coldark12" />

  <!-- XML -->
  <style name="xml:doctype" foreground="coldark08" />
  <style name="xml:cdata-delim" foreground="#FF0000" />
  <style name="xml:processing-instruction" foreground="coldark08" />
  <style name="xml:element-name" foreground="coldark08" />
  <style name="xml:attribute-name" foreground="coldark09" />
  <style name="xml:attribute-value" foreground="coldark11" />

  <!-- YAML -->
  <style name="yaml:map-key" foreground="coldark10" />
</style-scheme> 
Details https://gist.github.com/deingithub/f40e2f3b75a4daf471cd8847be14d966/ Language:
zig.lang

<?xml version="1.0" encoding="UTF-8" ?>

<!--

 Zig Syntax Highlighting for GTKSourceView components.
 Author: deing <admin@15318.de>. This file is available under Creative Commons Zero.
 To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide.
 This software is distributed without any warranty.
 You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. 

-->

<language id="zig" name="Zig" version="2.0" _section="Source">
  <metadata>
    <property name="globs">*.zig</property>
    <property name="line-comment-start">//</property>
  </metadata>

  <styles>
    <style id="keyword" name="Keyword" map-to="def:keyword" />
    <style id="builtin-fn" name="Builtin Function" map-to="def:preprocessor" />
    <style id="type" name="Type" map-to="def:type" />

    <style id="escape-sequence" name="Escaped Character" map-to="def:special-char" />
    <style id="comment" name="Comment" map-to="def:comment" />
    <style id="boolean" name="Boolean value" map-to="def:boolean" />
    <style id="string" name="String" map-to="def:string" />
    <style id="number" name="Number" map-to="def:number" />

    <style id="error" name="Error" map-to="def:error" />
  </styles>

  <definitions>
    <!-- All Zig keywords as specified in the 0.5.0 PEG -->
    <context id="keywords" style-ref="keyword">
      <keyword>align</keyword>
      <keyword>allowzero</keyword>
      <keyword>and</keyword>
      <keyword>asm</keyword>
      <keyword>async</keyword>
      <keyword>await</keyword>
      <keyword>break</keyword>
      <keyword>catch</keyword>
      <keyword>comptime</keyword>
      <keyword>const</keyword>
      <keyword>continue</keyword>
      <keyword>defer</keyword>
      <keyword>else</keyword>
      <keyword>enum</keyword>
      <keyword>errdefer</keyword>
      <keyword>error</keyword>
      <keyword>export</keyword>
      <keyword>extern</keyword>
      <keyword>fn</keyword>
      <keyword>for</keyword>
      <keyword>if</keyword>
      <keyword>inline</keyword>
      <keyword>nakedcc</keyword>
      <keyword>noalias</keyword>
      <keyword>null</keyword>
      <keyword>or</keyword>
      <keyword>orelse</keyword>
      <keyword>packed</keyword>
      <keyword>promise</keyword>
      <keyword>pub</keyword>
      <keyword>resume</keyword>
      <keyword>return</keyword>
      <keyword>linksection</keyword>
      <keyword>stdcallcc</keyword>
      <keyword>struct</keyword>
      <keyword>suspend</keyword>
      <keyword>switch</keyword>
      <keyword>test</keyword>
      <keyword>threadlocal</keyword>
      <keyword>try</keyworcd>
      <keyword>undefined</keyword>
      <keyword>union</keyword>
      <keyword>unreachable</keyword>
      <keyword>usingnamespace</keyword>
      <keyword>var</keyword>
      <keyword>volatile</keyword>
      <keyword>while</keyword>
    </context>

    <define-regex id="identifier" extended="true">
      [A-Za-z_][A-Za-z0-9_]*
    </define-regex>

    <define-regex id="hex-digit" extended="true">
      [0-9a-fA-F]
    </define-regex>

    <define-regex id="arbitrary-integer-type" extended="true">
      [ui][0-9]{1,5}
    </define-regex>

    <define-regex id="escape-sequence" extended="true">
      \\([rnt'"\\]|u\{\%{hex-digit}+\}|x\%{hex-digit}{2})
    </define-regex>

    <context id="builtin-fn" style-ref="builtin-fn">
      <match extended="true">
        @\%{identifier}
      </match>
    </context>

    <context id="boolean" style-ref="boolean">
      <keyword>true</keyword>
      <keyword>false</keyword>
    </context>

    <context id="type" style-ref="type">
      <match extended="true">
        \b(\%{arbitrary-integer-type}|isize|usize|f16|f32|f64|f128|bool|void|noreturn|type|anyerror|comptime_int|comptime_float|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void)
      </match>
    </context>

    <context id="escape-sequence" style-ref="escape-sequence">
      <match extended="true">
        \%{escape-sequence}
      </match>
    </context>

    <context id="string" end-at-line-end="true" style-ref="string">
      <start>c?"</start>
      <end>"</end>
      <include>
        <context ref="escape-sequence" />
      </include>
    </context>

    <context id="multiline-string" end-at-line-end="true" style-ref="string">
      <start>c?\\\\</start>
      <end>$</end>
      <include>
        <context ref="escape-sequence" />
      </include>
    </context>

    <context id="char" end-at-line-end="true" style-ref="string">
      <start>'</start>
      <end>'</end>
      <include>
        <context ref="escape-sequence" />
      </include>
    </context>

    <context id="integer" style-ref="number">
      <match extended="true">
        \b(0b[10]+|0o[0-7]+|0x\%{hex-digit}+|[0-9]+)
      </match>
    </context>

    <context id="float" style-ref="number">
      <match extended="true">
        0x\%{hex-digit}+\.\%{hex-digit}+([pP][-+]?\%{hex-digit}+)?|[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|0x\%{hex-digit}+\.?[pP][-+]?\%{hex-digit}+|[0-9]+\.?[eE][-+]?[0-9]+
      </match>
    </context>

    <context id="zig" class="no-spell-check">
      <include>
        <context ref="keywords" />
        <context ref="builtin-fn" />
        <context ref="type" />
        <context ref="boolean" />
        <context ref="string" />
        <context ref="multiline-string" />
        <context ref="char" />
        <context ref="float" />
        <context ref="integer" />
        <context ref="def:c-like-comment" style-ref="comment" />
      </include>
    </context>

  </definitions>
</language>

Note

I've updated the globs to <property name="globs">*.zig*</property> in order to match .zig.zon

Configuration directory

~/.local/share/gtksourceview-4/
├── language-specs
│   └── zig.lang
└── styles
    └── coldark-dark.xml
    └── pop-dark.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment