We have moved to a new Sailfish OS Forum. Please start new discussions there.
1

how to edit colors in a theme?

asked 2020-02-11 11:41:44 +0200

simosagi gravatar image

On my Sailfish device I'm generally happy with the default Freedom ambiance (the one with the origami). However, I noticed some apps use the primary and the secondary colors to show the status of a button, and in this case they are so similar to each other (white vs very light gray), that sometimes they look indistinguishable.

With the 'Theme Tool' app from openrepos I could check the colors of the theme, but is there a simple way to edit them (and e.g. make one slightly darker)?

edit retag flag offensive close delete

3 Answers

Sort by » oldest newest most voted
3

answered 2020-02-13 09:43:50 +0200

hsjpekka gravatar image

updated 2020-02-14 00:44:13 +0200

For temporal and instant change you can use dconf write /desktop/jolla/theme/color/highlight [COLOR] in terminal. 'highlight' can also be 'primary' and other theme colors. But this modification doesn't survive ambience change, while Edz's solution does.

edit flag offensive delete publish link more
2

answered 2020-02-11 13:13:33 +0200

Spam Hunter gravatar image

updated 2020-02-14 20:31:05 +0200

Edit the parameters set in the .ambience file.

/usr/share/ambience/ambience-aloe/ambience-aloe.ambience

which looks something like this (I've spaced the 4 components for visibility);

{
    "translationCatalog"        : "ambience-aloe",
    "displayName"               : "ambience-aloe-name",
    "ringerToneFile"            : { "file": "aloe-ringtone.mp3", "enabled": 1 },
    "messageToneFile"           : { "file": "aloe-message.mp3",  "enabled": 1 },
    "mailToneFile"              : { "file": "aloe-email.mp3",    "enabled": 1 },
    "internetCallToneFile"      : { "file": "aloe-im.mp3",       "enabled": 1 },
    "chatToneFile"              : { "file": "aloe-im.mp3",       "enabled": 1 },
    "calendarToneFile"          : { "file": "aloe-calendar.mp3", "enabled": 1 },
    "clockAlarmToneFile"        : { "file": "aloe-clock.mp3",    "enabled": 1 },
    "wallpaper"                 : "aloe.png",

    "highlightColor"            : "#50FFE0",
    "secondaryHighlightColor"   : "#FFBDE6CC",
    "primaryColor"              : "#FFFFFF",
    "secondaryColor"            : "#BBFFFFFF",

    "ringerVolume"              : 70,
    "colorScheme"               : "lightondark",
    "timestamp"                 : "2018-10-24T15:00:00",
    "version"                   : 3,
    "favorite"                  : true
}

Save your edit and restart the ambience service using the following command;

systemctl --user restart ambienced.service

Your ambience should now reflect your changes made to any of those 4 colour components.

The colour components consist of 8 hexadecimal pairs (ARGB (word order) = alpha-red-green-blue) ~ (alpha channel = opacity)

edit flag offensive delete publish link more
2

answered 2020-02-14 12:04:29 +0200

eriXD gravatar image

tl;dr: You have asked for an easy solution, and to be honest: There is none that I am aware of... but if you know what you are doing or if you are open to experimenting, there is a way to modify the user's ambience database in order to modify ambiences that you have created locally...

Edz's answer is very good and working well with preinstalled ambiences... however, if you want to modify / fine tune your own ambiences, you'll need:

  • developer mode & root access
  • sqlite3
  • minor experience with SQL

You would want to devel-su (or sudo) and open the user ambience db, but before you do, you should create a backup:

$ cd ~/.local/share/system/privileged/Ambienced
$ cp ambienced.sqlite ambienced.sqlite.bak
$ sqlite3 ambienced.sqlite

to see table headers, use

sqlite> .headers on

to list all tables, use

sqlite> .tables

there should be an "ambience" table, which is the one you'll want to modify... however, it will not tell you, how the ambiences are called (although you might be able to deduce that from the file name)... but there is a solution: the file table will give you the respective id, but it will do so for all files (ambience images, ringtones, ...), so in order to get just what you need, the best thing would probably be (with an example output):

sqlite> select fileId,displayName from ambience inner join file on file.id = ambience.fileId;
fileId|displayName
1|Zuneigung
2|Luftig
3|Fluss
4|Frische
5|Glazial
6|Harmonie
7|Intensiv
8|Freiheit
9|Party
10|Rollend
11|Sailfish 3

To look at some values, you would select the values (or everything with an asterisk) from the corresponding id entry, e.g.

sqlite> select * from ambience where fileId = 11;
fileId|favorite|colorScheme|homeWallpaper|applicationWallpaper|highlightColor|secondaryHighlightColor|primaryColor|secondaryColor|timestamp|ringerVolume|enabledSounds|partnerSpace|version
11|1|0|/usr/share/ambience/sailfish3/images/ambience_sailfish3.jpg|/home/nemo/.cache/ambienced/com/jolla/components/bgimages/2edc6197ap.jpg|#ff01bcf9|#b001bcf9|#ffffffff|#b0ffffff|2015-01-01T23:00:00|80|-1||2

Color values are ARGB, if I remember correctly... If you, for some reason, wanted to change the highlight color to red, you would do:

sqlite> update ambience set highlightColor='#ffff0000' where fileId=11;

You can change a lot of things... and you can break a lot of things, so I really do recommend you make a backup of the table before modfying anything...

These changes are permanent, on a user basis and theoretically can be moved to another system (of course you would have to move the accessed files as well and put them in the same location or else you might break something).

On might also point out, that it actually seems to be easier to create a "system ambience file" from your own stuff and put that to /usr/share/ambience/ - it all depends on wether you want to modify it in system or user space...

edit flag offensive delete publish link more

Comments

I would like to suggest another way. Edit the ambience file, move the sqlite files away, restart phone. I think it is less dangerous.

A.Maretzek ( 2020-02-23 15:02:32 +0200 )edit

Sure, this would work (as I pointed out in my text) for system ambiences and if you want to do system-wide modifications.

My answer, however, will also work with user defined ambiences (i.e. ambiences that have been manually created from a picture or photo), which will not create an ambience-file (but I also mention in my last sentence, that you could create such a file yourself and place it in the same folder as the others).

eriXD ( 2020-02-24 06:53:27 +0200 )edit
Login/Signup to Answer

Question tools

Follow
3 followers

Stats

Asked: 2020-02-11 11:41:44 +0200

Seen: 525 times

Last updated: Feb 14 '20