Skip to content

Commit 2c98180

Browse files
authored
feat(classic UI): how to get a minimal barceloneta integration
Explain all the steps to get a custom CSS bundle out of barceloneta theme to style the core/backend parts of Plone Classic UI.
1 parent 9718cfd commit 2c98180

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

docs/classic-ui/theming/from-scratch.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,85 @@ yarn dist
123123
- Import Boostrap (as basis)
124124

125125

126+
#### Minimal backend styling
127+
128+
When creating a theme from scratch, it still makes sense (and saves time) to reuse the barceloneta theme for:
129+
130+
- Plone toolbar
131+
- add/edit forms
132+
- control panels
133+
134+
To be able to do so:
135+
136+
- create a new CSS file on your theme like this:
137+
138+
```scss
139+
// plone variables (used in toolbar)
140+
// Plone specific colors
141+
//colors
142+
$state-draft-color: #fab82a!default; // lime-yellow //draft is visible
143+
$state-pending-color: #e2e721!default; // orange
144+
$state-private-color: #c4183c!default; // red
145+
$state-internal-color: #fab82a!default; // is draft
146+
$state-internally-published-color: #883dfa!default; // is intranet
147+
$plone-link-color: #007bb1!default; //plone blue made slightly darker for wcag 2.0
148+
$spacer: 1rem!default;
149+
150+
// Toolbar
151+
$plone-toolbar-bg: rgba(0, 0, 0, 0.9);
152+
$plone-toolbar-submenu-bg: rgba(20, 20, 20, 0.95);
153+
$plone-toolbar-font-primary: "Roboto Condensed", sans-serif;
154+
$plone-toolbar-font-secondary: "Roboto", sans-serif;
155+
$plone-toolbar-separator-color: rgba(255, 255, 255, 0.17);
156+
$plone-toolbar-link: $plone-link-color;
157+
$plone-toolbar-text-color: rgba(255, 255, 255, 0.9);
158+
$plone-toolbar-submenu-text-color: #fff;
159+
$plone-toolbar-submenu-header-color: lighten(#000, 80%);
160+
161+
$plone-toolbar-locked-color: var(--bs-warning); // is intranet
162+
163+
$plone-toolbar-width: 220px;
164+
$plone-toolbar-width-collapsed: calc($spacer * 2.25);
165+
$plone-toolbar-top-height: calc($spacer * 2.5);
166+
167+
@import "bootstrap/scss/bootstrap";
168+
169+
@import "@plone/plonetheme-barceloneta-base/scss/toolbar";
170+
@import "@plone/plonetheme-barceloneta-base/scss/controlpanels";
171+
@import "@plone/plonetheme-barceloneta-base/scss/forms";
172+
```
173+
174+
!!! tip
175+
See all the [barceloneta SCSS files](https://github.com/plone/plonetheme.barceloneta/tree/master/scss)
176+
that are available and import the ones that you want to use.
177+
178+
Add `@plone/plonetheme-barceloneta-base` as a dependency:
179+
180+
```shell
181+
yarn add @plone/plonetheme-barceloneta-base
182+
```
183+
184+
Add a script on `package.json` to compile the CSS:
185+
186+
```json
187+
"css-compile-main": "sass --load-path=node_modules --style expanded --source-map --embed-sources --no-error-css plone.scss:../static/plone.css"
188+
```
189+
190+
!!! tip
191+
Look at [plonetheme.barcelonta package.json](https://github.com/plone/plonetheme.barceloneta/blob/master/package.json)
192+
for a few more scripts to prefix and minify your CSS to get a production ready bundle.
193+
194+
Run the compilation:
195+
196+
```shell
197+
yarn run css-compile-main
198+
```
199+
200+
Finally, register the [CSS as a bundle](#bundle-registration).
201+
202+
With this, you will save yourself quite some work on styling the toolbar, the add/edit forms and controlpanels,
203+
while keeping the rest of your theming on your own.
204+
126205
#### Templates
127206

128207
- Add `z3c.jbot` overrides

0 commit comments

Comments
 (0)