Always subtheme your administration theme, it provides the following benefits:
- You have a stylesheet ready for ongoing administration tweaks.
- It's an opportunity to demonstrate good sub-theme practice to junior devs.
- It's a place to put the custom favicon, rather than as a file upload.
- You can do a sexy logo that feels good.
Feels good? One of my favourite administration sub-themes was for the National Library, which has wonderful stained glass in the foyer.
Our L'Seven
Here is Lil Engine's current administration subtheme affectionately known as L'Seven, and a brief breakdown of the files therein. It delivers the princely sum of four lines of CSS.
lilseven.info.yml
It's worth noting that, as in Drupal 7, you should explicitly re-declare the regions from the parent theme. We found that they don't inherit consistently.
name: "L'seven"
type: theme
description: 'Overrides for the Seven theme.'
core: 8.x
base theme: seven
screenshot: logo.png
libraries:
- lilseven/admin-styles
regions:
header: 'Header'
pre_content: 'Pre-content'
breadcrumb: Breadcrumb
highlighted: Highlighted
help: Help
content: Content
page_top: 'Page top'
page_bottom: 'Page bottom'
sidebar_first: 'First sidebar'
lilseven.libraries.yml
admin-styles:
css:
theme:
css/admin-styles.css: {}
css/admin-styles.css
This file obviously matches the file name in lilseven.libraries,yml
, it could have been called anything.
/* Fix the codesnippet dialog box to use a monospace font. */
.cke_dialog_body textarea.cke_dialog_ui_input_textarea {
font-family: "Lucida Console", Monaco, monospace;
white-space: nowrap;
}
Lastly, why Seven?
Don't!. I recommend that you sub-theme Adminimal instead. It's still one of the more robust administration themes and works nicely with GovCMS.