1

So I want to use Anjuta and add a Theme. I use the GtkSourceView plugin as my editor. For some reason it doesn't allow me to define colors like with any any other editor but instead requires me to use a gtk theme.

I use Ubuntu Mate 20.04. I'm not sure why but gtksourceview-3.0 and gtksourceview-4 are both installed on my system.

To add a theme I tried a few things. I read someplace that you can make themes with a project called "oomox". I tried that, but it created a massive array of files and directories that didn't seem at all like what GtkSourceView uses, which is a single file. So I scrapped that.

I coped obsidian.xml (the closest to what I want my thing to look like) from /usr/share/gtksourceview-4/styles and edited it. I placed my new file into ~/.themes. That didn't work (it doesn't show up in the list when selecting a theme for Anjuta). I tried ~/.local/share/gtksourceview-4/styles and ~/.local/share/gtksourceview-3.0/styles and also ~/.local/share/gedit and ~/.local/share/gedit/styles (gedit is not installed though).

I am confused how I can add a simple style to this editor and why there isn't any information on that topic. I can imagine people wanting to customize their IDE all the time. Maybe I'm missing something obvious? I searched "adding theme to gtksourceview" and "adding theme to Anjuta". And all I found was how to add a theme to gedit (hence my attempts above) and how to switch the default themes.

Also I don't want to add my theme to the system install directory (/usr or /etc). Surely there is a way to add it for users (/home/<user>) only.

It would be really nice if there were some program I could use to edit my style and give me a preview of some code. (Like most other IDEs). If there is no such thing, then I'd be really nice to at least have a list of all the valid tags.

Edit: Just to test it, I put the new file in with the rest of them in /usr/share/gtksourceview-4/styles/ and 3.0 and 2. Neither soft links nor the file itself seemed to have an effect. I'm very confused. I doublechecked the file itself. All I did was add/delete some color tags and change colors about.

For clarity's sake here is the file.

custom.xml

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

<style-scheme id="custom" _name="custom" version="1.0">

<author>MyName</author> <_description>Dark color scheme.</_description>

<color name="green" value="#00FF00"/> <color name="darkgreen" value="#008000"/> <color name="red" value="#FF0000"/> <color name="orange" value="#FF8000"/> <color name="yellow" value="#FF0000"/> <color name="blue" value="#0000FF"/> <color name="lightblue" value="#00FFFF"/> <color name="purple" value="#8080FF"/> <color name="gray" value="#808080"/> <color name="darkgray" value="#404040"/> <color name="bggray" value="#202020"/> <color name="purple" value="#8080FF"/> <color name="white" value="#ffffff"/>

<!-- Global Settings --> <style name="text" foreground="green" background="bggray"/> <style name="selection" foreground="green" background="gray"/> <style name="cursor" foreground="white" background="bggray"/> <style name="secondary-cursor" foreground="darkgray" background="bggray"/> <style name="current-line" background="gray"/> <style name="line-numbers" foreground="yellow" background="#black"/> <style name="draw-spaces" foreground="gray"/> <style name="background-pattern" background="bggray"/>

<!-- Bracket Matching --> <style name="bracket-match" foreground="yellow"/> <style name="bracket-mismatch" foreground="yellow" background="red"/>

<!-- Right Margin --> <style name="right-margin" foreground="gray" background="bggray"/>

<!-- Search Matching --> <style name="search-match" background="orange"/>

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

<!-- Constants --> <style name="def:constant" foreground="yellow"/> <style name="def:string" foreground="yellow"/> <style name="def:special-char" foreground="orange"/> <style name="def:special-constant" foreground="orange"/> <style name="def:floating-point" foreground="purple"/>

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

<!-- Statements --> <style name="def:statement" foreground="green" bold="true"/>

<!-- Types --> <style name="def:type" foreground="blue" bold="true"/>

<!-- Others --> <style name="def:preprocessor" foreground="red"/> <style name="def:error" foreground="red" background="orange" bold="true"/> <style name="def:warning" foreground="yellow" background="orange" bold="true"/> <style name="def:note" foreground="lightblue" background="bggray" bold="true"/> <style name="def:underlined" italic="true" underline="single"/>

<!-- Heading styles, uncomment to enable --> <!-- <style name="def:heading0" scale="5.0"/> <style name="def:heading1" scale="2.5"/> <style name="def:heading2" scale="2.0"/> <style name="def:heading3" scale="1.7"/> <style name="def:heading4" scale="1.5"/> <style name="def:heading5" scale="1.3"/> <style name="def:heading6" scale="1.2"/> -->

<!-- Language specific --> <style name="diff:added-line" foreground="darkgreen"/> <style name="diff:removed-line" foreground="red"/> <style name="diff:changed-line" foreground="yellow"/> <style name="diff:diff-file" foreground="green" bold="true"/> <style name="diff:location" foreground="green"/> <style name="diff:special-case" foreground="white" bold="true"/>

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

</style-scheme>

Edit 2: I found these resources: https://developer.gnome.org/gtksourceview/stable/style-reference.html
But they don't detail which style names are valid. Or where to put the style file.

FalcoGer
  • 925

0 Answers0