Skip to content

Commit cbfe9a5

Browse files
committed
Update Themes section; Add link to Vaadin's Lumo Theme Editor #991
1 parent d6c359e commit cbfe9a5

3 files changed

Lines changed: 51 additions & 15 deletions

File tree

-36 KB
Binary file not shown.
-30.4 KB
Binary file not shown.

content/modules/flow-ui/pages/themes/themes.adoc

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Themes are used to manage the visual presentation of the application.
55

66
A theme consists of CSS files and other resources like images and fonts.
77

8-
Jmix provides *jmix-lumo* theme built on top of Vaadin https://vaadin.com/docs/latest/styling/lumo[Lumo theme^].
8+
Jmix provides *jmix-lumo* theme built on top of Vaadin's https://vaadin.com/docs/latest/styling/lumo[Lumo^] theme.
99

1010
[[applying-theme]]
1111
== Applying a Theme
@@ -35,26 +35,52 @@ NOTE: Themes cannot be switched at runtime. Although a project may have multiple
3535
[[application-theme]]
3636
== Application Theme
3737

38-
For use in an application, the theme folder is placed inside the `frontend/themes` folder, with a name of your choosing. Jmix application projects created using Studio have a predefined theme folder with the same name as the project itself.
38+
Themes, available to the application, are located inside the `src/main/frontend/themes` folder. Jmix application projects created using Studio have a predefined theme folder with the same name as the project itself.
3939

40-
.Theme folder file structure
41-
image::themes/theme-folder-structure.png[align="center", width="285"]
40+
For example:
4241

43-
* `my-project` - the theme folder, also used as theme name
44-
* `styles.css` - the master stylesheet
45-
* `my-project.css` - an entry point for custom styles and imports
46-
* `theme.json` - a theme configuration file, which by default defines *jmix-lumo* as the default theme.
42+
[source]
43+
----
44+
src
45+
└── main
46+
└── frontend
47+
└── themes
48+
└── my-project
49+
├── my-project.css
50+
├── styles.css
51+
├── theme.json
52+
└── view
53+
├── login-view.css
54+
├── main-view-top-menu.css
55+
└── main-view.css
56+
----
4757

48-
`styles.css` is the entry point to the theme's styles. All CSS, including *Lumo* style property values and custom component styles, can be added there.
58+
* `my-project` - the theme folder. Its name is used as the theme name for the <<applying-theme,@Theme>> annotation.
59+
* `styles.css` - the main stylesheet, which is the entry point to this project's theme styles.
60+
* `my-project.css` - a stylesheet for custom styles and imports.
61+
* `theme.json` - the theme configuration file. By default, it defines *jmix-lumo* as the parent theme.
62+
* `view` - this folder contains CSS files that define styles for the login and main views provided by the project template.
4963

50-
It can be useful to split CSS into multiple files to avoid cluttering the main stylesheet. Additional CSS files are loaded using `@import` directives. By default, the project's master stylesheet contains a single import of `<theme-name>.css` file that defines your styles and any other imports.
64+
All CSS, including CSS variable values and custom component styles, can be included in the main `styles.css` file. However, by default, this file contains only import directives, with the actual CSS organized into separate files to make it easier to handle:
5165

5266
[source,css,indent=0]
5367
.styles.css
5468
----
55-
@import url('./my-project.css');
69+
@import url('my-project.css');
70+
@import url('view/main-view.css');
71+
@import url('view/main-view-top-menu.css');
72+
@import url('view/login-view.css');
5673
----
5774

75+
Place your project's CSS in the `<theme_name>.css` file (in this example, it's `my-project.css`).
76+
77+
[TIP]
78+
====
79+
Use Vaadin's online https://demo.vaadin.com/lumo-editor/[Lumo theme editor^] to quickly create a customized theme for your application.
80+
81+
To select the desired appearance, use the controls in the right-side panel. Then, click *Download* and insert the provided CSS code, located within the `<style>` tags, into your `<theme_name>.css` file.
82+
====
83+
5884
[[reusable-theme]]
5985
== Reusable Theme
6086

@@ -68,11 +94,21 @@ An application theme can be used in multiple applications by packaging it as a J
6894

6995
The theme project's structure looks as follows:
7096

71-
.Theme project structure
72-
image::themes/theme-addon-structure.png[align="center", width="296"]
97+
[source]
98+
----
99+
src
100+
└── main
101+
└── resources
102+
└── META-INF
103+
└── resources
104+
└── themes
105+
└── cobalt
106+
├── styles.css
107+
└── theme.json
108+
----
73109

74-
* `cobalt` - the theme folder, also used as theme name
75-
* `styles.css` - the master stylesheet. Can contain custom styles and imports, for example:
110+
* `cobalt` - the theme folder, also used as theme name.
111+
* `styles.css` - the main stylesheet. Can contain custom styles and imports, for example:
76112
+
77113
[source,css]
78114
----

0 commit comments

Comments
 (0)