Introuducing "Darktable CSS": a theme/snippet repository for darktable theming

Hi all,

From the discussion in Poll: updating the default grey themes it appears that there is a desire to have some kind of repository for darktable themes and CSS snippets for user.css.

With the help of Gemini I put together something quick and dirty, and you can try it out here: http://darktable-css.danielepighin.net.

For the moment it’s very basic, but it’s possible to upload and download themes and CSS snippets. If you want to upload a new theme or snippet, go ahead, create an account and submit your contribution.

Temporarily it’s hosted on my website, but I am more than happy to transfer ownership to the DT team and/or move it to DT’s hosting if the devs so desire.

In the meantime, please go ahead and upload your content if you would like to share your tweaks. Be aware that at the moment it’s more or less a proof of concept and there is no guarantee that the service will stay up or that the db will not have to be reset at some point.

So, use at your own risk and hopefully have fun :slight_smile:

23 Likes

@difrkaguilar check this out, it may be of interest to you :wink:

1 Like

Thanks you @rgo I’ll see it asap.

Greetings from Mérida, Yucatán.

1 Like

Could you upload your one with the green activated icon. I for one would find that a Godsend

It’s there already: GrayDarkerRoundedHeadersWithAccents

Just add this and tweak the color or brightness to your liking…

#module-header .dt_module_btn:checked
{
color: #7afa97;
}

Ooops, by mistake I had made the files downloadable only by logged in users. Fixed that.

Let’s dream now :slight_smile:

Next to the download button display the theme id (1 for the one linked above IIUC).

And create a Lua script where users just have to type the id to download and install the theme directly from Darktable.

5 Likes

Dream bigger! On initialization the lua script could theoretically fetch a list of themes with name and id to populate into a selectable element.

Thinking out loud, the lua script would have to access the user.css file and update it. It should probably make a backup of the existing one. Then the lua script would have to apply those changes, not sure if that’s something the lua scripts have access to.

1 Like

This thing need a code review before I want DT fetching stuff from it. “Quickly vide coded” does not inspire confidence, sorry.

2 Likes

Inspiring confidence is certainly not what it does :rofl:

BTW to download into DT you wouldn’t need to rely on the code of the website. Each CSS (both themes and snippets) are stored in their own file. To download the theme into DT one would only need a small function that does a table lookup into the DB and downloads the corresponding file, and that can be reviewed easily.

The website code doesn’t control access to the db?

We can factor out a 5-liner function that does a lookup by id and returns the file name and put it in its own .php script.

Or we can change the code to use the same id for the entry in the db and for the file name, so that we don’t even have to pass from the db at all.

What is there to stop malicious input?

We are talking about CSS that is going to be parsed by GTK+, the worst thing that can happen is that the layout of the UI is messed up. Of course, the LUA script that @Pascal_Obry is dreaming about should be reviewed to ensure that (1) it only downloads the CSS and (2) it is not destructive.

well … you need to store the CSS somewhere. so depending if the code for this was well written you can have a lot of fun

https://www.explainxkcd.com/wiki/index.php/Little_Bobby_Tables

do you use SQL? are your SQL queries created with string concat? do you use any input from the user for it?

even if it is “i just store files on disk” … as long as you give the user some control over the file path … they can have a lot of fun (Hello ../../../../../../etc/passwd )

also CSS is not free of “fun”. it can be used to hide data. I wonder if you can have fun with make funny CSS that is super slow to render.

To quote lockpicking lawyer “Everyone knows what it was meant for, but ask yourself what can it be used for.”

1 Like

No, the user has no control over the location of the files.

In this case we are talking about downloading a CSS file from a web server to be used for skinning an application. I am not aware of GTK+ exploits that use CSS, if you know one I am happy to learn something new.

BTW, as always, downloading content from the internet comes with some degree of risk, which in this case is pretty minimal, and the users who decide to do so should be aware of that.

i was talking about your webapp.

Ah, that is possibly full of leaks, and it was part of my original disclaimer. It is just a proof of concept, and I am not planning to spend a lot of effort making it failproof.

What I care about is that there are no big risks for the users who download CSS from it, which is what @paperdigits was rightly expressing concerns about.

2 Likes

ok but we can take it and run it on our infrastructure? I don’t understand where we’re trying to go with this.