Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom syntax styles #3

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ install_data(
meson.project_name() + '.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
)

install_data([
'styles/elementary-dark.xml',
'styles/elementary-light.xml',
], install_dir: join_paths(get_option('datadir'), 'gtksourceview-4', 'styles'))
Binary file modified data/screenshots/000-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/screenshots/000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 113 additions & 0 deletions data/styles/elementary-dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>

<style-scheme id="elementary-dark" _name="elementary Dark" version="1.0">
<author>Micah Ilbery</author>
<_description>Color scheme using the elementary color palette</_description>

<!-- Background Colors Palette -->
<color name="bg-0" value="#485a6c"/> <!-- SLATE500 -->
<color name="bg-1" value="#2a3441"/> <!-- SLATE700 BLACK500 MIX 75% -->
<color name="bg-2" value="#212730"/> <!-- SLATE700 BLACK700 MIX 50% -->
<color name="bg-3" value="#1d2125"/> <!-- SLATE700 BLACK700 MIX 25% -->
<color name="bg-4" value="#0e141f"/> <!-- SLATE900 -->

<color name="fg-0" value="#d4d4d4"/> <!-- SILVER300 -->
<color name="fg-1" value="#abacae"/> <!-- SILVER500 -->
<color name="fg-2" value="#667885"/> <!-- SLATE300 -->

<color name="yellow" value="#ffe16b"/> <!-- BANANA -->
<color name="orange" value="#ffa154"/> <!-- ORANGE -->
<color name="red" value="#ed5353"/> <!-- STRAWBERRY -->
<color name="pink" value="#f4679d"/> <!-- BUBBLEGUM -->
<color name="purple" value="#cd9ef7"/> <!-- GRAPE -->
<color name="blue" value="#64baff"/> <!-- BLUEBERRY -->
<color name="cyan" value="#28bca3"/> <!-- MINT -->
<color name="green" value="#9bdb4d"/> <!-- LIME -->

<!-- Global Settings -->
<style name="text" foreground="fg-0" background="bg-2"/>
<style name="selection" foreground="bg-4" background="bg-0"/>
<style name="cursor" foreground="fg-0"/>
<style name="secondary-cursor" foreground="fg-1"/>
<style name="current-line" background="bg-1"/>
<style name="line-numbers" foreground="fg-2" background="bg-3"/>
<style name="background-pattern" background="bg-4"/>
<style name="draw-spaces" foreground="fg-2"/>

<!-- Bracket Matching -->
<style name="bracket-match" foreground="bg-4" background="fg-0"/>
<style name="bracket-mismatch" foreground="red" background="fg-2"/>

<!-- Right Margin -->
<style name="right-margin" foreground="bg-2" background="fg-1"/>

<!-- Search Matching -->
<style name="search-match" foreground="bg-4" background="yellow"/>

<!-- Comments -->
<style name="def:comment" foreground="fg-2"/>
<style name="def:shebang" foreground="fg-2" bold="true"/>
<style name="def:doc-comment-element" italic="true"/>

<!-- Constants -->
<style name="def:constant" foreground="cyan"/>
<style name="def:special-char" foreground="green"/>

<!-- Identifiers -->
<style name="def:identifier" foreground="blue"/>

<!-- Statements -->
<style name="def:statement" foreground="orange"/>

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

<!-- Markup -->
<style name="def:emphasis" italic="true"/>
<style name="def:strong-emphasis" foreground="orange"/>
<style name="def:inline-code" foreground="blue"/>
<style name="def:insertion" underline="single"/>
<style name="def:deletion" strikethrough="true"/>
<style name="def:link-text" foreground="fg-2"/>
<style name="def:link-symbol" foreground="fg-2" bold="true"/>
<style name="def:link-destination" italic="true" underline="single"/>
<style name="def:heading" foreground="yellow"/>
<style name="def:thematic-break" foreground="yellow"/>
<style name="def:preformatted-section" foreground="blue"/>
<style name="def:list-marker" foreground="orange"/>

<!-- Operators -->
<style name="def:operator" foreground="green"/>

<!-- Others -->
<style name="def:preprocessor" foreground="purple"/>
<style name="def:error" foreground="red" bold="true"/>
<style name="def:note" foreground="pink" bold="true"/>
<style name="def:net-address" italic="true" underline="single"/>

<!-- Language specific styles -->
<style name="diff:added-line" foreground="green"/>
<style name="diff:removed-line" foreground="red"/>
<style name="diff:changed-line" foreground="yellow"/>
<style name="diff:special-case" use-style="def:constant"/>
<style name="diff:location" use-style="def:statement"/>
<style name="diff:diff-file" use-style="def:type"/>

<style name="xml:tags" foreground="cyan"/>
<style name="xml:attribute-name" foreground="purple"/>
<style name="xml:namespace" foreground="green" bold="true"/>

<style name="js:built-in-constructor" use-style="def:identifier"/>

<style name="latex:display-math" foreground="purple"/>
<style name="latex:command" foreground="green" bold="true"/>
<style name="latex:include" use-style="def:preprocessor"/>

<style name="sh:variable" foreground="purple"/>

<!-- legacy styles for old lang files -->
<style name="Others" foreground="green" bold="true"/>
<style name="Others 2" foreground="cyan"/>
<style name="Others 3" foreground="purple"/>

</style-scheme>
113 changes: 113 additions & 0 deletions data/styles/elementary-light.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>

<style-scheme id="elementary-light" _name="elementary Light" version="1.0">
<author>Micah Ilbery</author>
<_description>Color scheme using the elementary color palette</_description>

<!-- Background Colors Palette -->
<color name="bg-0" value="#f7f3ed"/> <!-- LATTE100 SILVER100 MIX 25% -->
<color name="bg-1" value="#f5eddf"/> <!-- LATTE100 SILVER100 MIX 50% -->
<color name="bg-2" value="#f2e6d2"/> <!-- LATTE100 SILVER100 MIX 75% -->
<color name="bg-3" value="#f0e2c9"/> <!-- LATTE100 SILVER100 MIX 90% -->
<color name="bg-4" value="#efdfc4"/> <!-- LATTE100 -->

<color name="fg-0" value="#555761"/> <!-- SILVER900 -->
<color name="fg-1" value="#7e8087"/> <!-- SILVER700 -->
<color name="fg-2" value="#abacae"/> <!-- SILVER300 -->

<color name="yellow" value="#d48e15"/> <!-- BANANA700 -->
<color name="orange" value="#cc3b02"/> <!-- ORANGE700 -->
<color name="red" value="#c6262e"/> <!-- STRAWBERRY500 -->
<color name="pink" value="#bc245d"/> <!-- BUBBLEGUM700 -->
<color name="purple" value="#a56de2"/> <!-- GRAPE500 -->
<color name="blue" value="#3689e6"/> <!-- BLUEBERRY500 -->
<color name="cyan" value="#0e9a83"/> <!-- MINT700 -->
<color name="green" value="#68b723"/> <!-- LIME500 -->

<!-- Global Settings -->
<style name="text" foreground="fg-0" background="bg-1"/>
<style name="selection" foreground="fg-1" background="bg-4"/>
<style name="cursor" foreground="fg-0"/>
<style name="secondary-cursor" foreground="fg-1"/>
<style name="current-line" background="bg-1"/>
<style name="line-numbers" foreground="fg-1" background="bg-2"/>
<style name="background-pattern" background="bg-4"/>
<style name="draw-spaces" foreground="fg-1"/>

<!-- Bracket Matching -->
<style name="bracket-match" foreground="bg-4" background="fg-2"/>
<style name="bracket-mismatch" foreground="red" background="fg-2"/>

<!-- Right Margin -->
<style name="right-margin" foreground="bg-3" background="fg-1"/>

<!-- Search Matching -->
<style name="search-match" foreground="bg-4" background="yellow"/>

<!-- Comments -->
<style name="def:comment" foreground="fg-1"/>
<style name="def:shebang" foreground="fg-1" bold="true"/>
<style name="def:doc-comment-element" italic="true"/>

<!-- Constants -->
<style name="def:constant" foreground="cyan"/>
<style name="def:special-char" foreground="green"/>

<!-- Identifiers -->
<style name="def:identifier" foreground="blue"/>

<!-- Statements -->
<style name="def:statement" foreground="orange"/>

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

<!-- Markup -->
<style name="def:emphasis" italic="true"/>
<style name="def:strong-emphasis" foreground="orange"/>
<style name="def:inline-code" foreground="blue"/>
<style name="def:insertion" underline="single"/>
<style name="def:deletion" strikethrough="true"/>
<style name="def:link-text" foreground="fg-1"/>
<style name="def:link-symbol" foreground="fg-1" bold="true"/>
<style name="def:link-destination" italic="true" underline="single"/>
<style name="def:heading" foreground="yellow"/>
<style name="def:thematic-break" foreground="yellow"/>
<style name="def:preformatted-section" foreground="blue"/>
<style name="def:list-marker" foreground="orange"/>

<!-- Operators -->
<style name="def:operator" foreground="green"/>

<!-- Others -->
<style name="def:preprocessor" foreground="purple"/>
<style name="def:error" foreground="red" bold="true"/>
<style name="def:note" foreground="pink" bold="true"/>
<style name="def:net-address" italic="true" underline="single"/>

<!-- Language specific styles -->
<style name="diff:added-line" foreground="green"/>
<style name="diff:removed-line" foreground="red"/>
<style name="diff:changed-line" foreground="yellow"/>
<style name="diff:special-case" use-style="def:constant"/>
<style name="diff:location" use-style="def:statement"/>
<style name="diff:diff-file" use-style="def:type"/>

<style name="xml:tags" foreground="cyan"/>
<style name="xml:attribute-name" foreground="purple"/>
<style name="xml:namespace" foreground="green" bold="true"/>

<style name="js:built-in-constructor" use-style="def:identifier"/>

<style name="latex:display-math" foreground="purple"/>
<style name="latex:command" foreground="green" bold="true"/>
<style name="latex:include" use-style="def:preprocessor"/>

<style name="sh:variable" foreground="purple"/>

<!-- legacy styles for old lang files -->
<style name="Others" foreground="green" bold="true"/>
<style name="Others 2" foreground="cyan"/>
<style name="Others 3" foreground="purple"/>

</style-scheme>
2 changes: 1 addition & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Application : Gtk.Application {
settings = Services.Settings.get_default ();

_default_font = new Models.Font () {
font = new GLib.Settings ("org.gnome.desktop.interface").get_string ("font-name")
font = new GLib.Settings ("org.gnome.desktop.interface").get_string ("monospace-font-name")
};
_current_font = new Models.Font () {
font = _default_font.font,
Expand Down
5 changes: 3 additions & 2 deletions src/Views/CodecardView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class Views.CodecardView : Gtk.ScrolledWindow {
public Gtk.SourceStyleSchemeManager style_scheme_manager;
public Gtk.SourceView editor;

private const string STYLE_SCHEME_LIGHT = "solarized-light";
private const string STYLE_SCHEME_DARK = "solarized-dark";
private const string STYLE_SCHEME_LIGHT = "elementary-light";
private const string STYLE_SCHEME_DARK = "elementary-dark";

public string background_color { get; private set; }
public int editor_margin { get; default = 12; }
Expand Down Expand Up @@ -74,6 +74,7 @@ public class Views.CodecardView : Gtk.ScrolledWindow {

if (text_style != null && text_style.background_set && !("rgba" in text_style.background)) {
background = text_style.background;

background_color = background;
}

Expand Down