Developer forum

Forum » Swift » Swift 2 theme customization

Swift 2 theme customization

Joakim
Reply

Hi,

I'm wondering if there's any documentation regarding creating custom/modifying existing themes in current Swift 2?


Replies

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply
This post has been marked as an answer

Hi Joakim

I am not sure if there is any good documentation on this. Themes on Swift 2 is made with the built in Theme setup in DynamicWeb, and it quite powerful. Here is a good example on how to extend the possibilites on a custom setup:

We would like to color the subtitle, based on the selected color scheme. But the color schemes does not have any colors that makes sense to use for this:


In the colorschemes, add a new color on each of your schemes, like this:



This creates a new css variable for you to use. The generated variable name is like this: --dw-color-ID Which means our variable here will be --dw-color-accent 

Last step is to created the css that target the subtitle on text paragraphs:

[data-swift-text] .dw-paragraph-1 {
        color: var(--dw-color-accent);
    }


And here is the result:

By the way, the generated css files, containing the variables, are saved in "Files/System/Styles/ColorSchemes" - They are good to look at for reference, but you should not directly edit them.


Did this answer your question?


Best regards
Karsten Thuen
 

Votes for this answer: 1

 

You must be logged in to post in the forum