Deft Docs

Themes

A Deft theme is one CSS file. It sets the colors, fonts and sizes the app is drawn with through CSS variables, and can style any part of the window by its classes. Themes of your own work in the desktop app; the phone and tablet apps have the built-in themes.


Adding a theme


Open Themes Folder, in Settings › Appearance, opens the folder Deft reads themes from. Put a file ending in .css there and it is listed under Theme, by the file’s name, the next time Appearance is opened. While a theme is in use, Deft picks up each save of its file within a couple of seconds, so you can edit a theme and watch it change.


The folder is at:


  • Mac: ~/Library/Application Support/com.usedeft.deft/themes
  • Windows: %APPDATA%\com.usedeft.deft\themes
  • Linux: ~/.config/com.usedeft.deft/themes


The built-in themes are on GitHub, to start from or to copy parts of.


Light and dark


A theme for one mode sets color-scheme on :root, and the app stays in that mode while the theme is in use.


:root {
	color-scheme: dark;
	--background: #1e1e1e;
	--foreground: #e8e8e8;
}


A theme with both modes gives each its own block, and follows Color Scheme in Settings. Set colors only inside the two blocks: a color in plain :root applies in both modes.


:root[data-mode='light'] {
	color-scheme: light;
	--background: #ffffff;
}

:root[data-mode='dark'] {
	color-scheme: dark;
	--background: #1e1e1e;
}

:root[data-mode='dark'] .deft-sidebar {
	--background: #181818;
}


Keep the blocks flat, as here. Deft finds a theme’s modes in its :root blocks, not in @media (prefers-color-scheme) or nested rules.


Fonts and pictures


Three fonts come with Deft: 'Inter Variable', 'Lilex Variable' (monospace) and 'Literata Variable' (serif). Fonts and pictures of your own go in the themes folder beside the theme and are loaded with a relative url(). A theme can’t load anything from the web: @import and fonts from a web address are blocked.


@font-face {
	font-family: 'My Font';
	src: url(fonts/my-font.woff2);
}

:root {
	--editor-font-family: 'My Font', serif;
}


--editor-font-family is the note’s font, and --font-family the rest of the window’s, Settings and menus included.


How a theme applies


The app’s own styles sit in a CSS cascade layer and a theme’s rules don’t, so a theme’s rule wins whatever its specificity, without !important. The editor is the exception: its styles are added while it runs and can’t be layered, so a rule on a .cm- class needs .cm-editor in front of it, and may still lose.


To color one part of the window, set the variables on its class, and its text and borders follow, as .deft-sidebar does in the example above.


Variables


These are the stable part of a theme: new ones can come in a new version, but none is renamed or removed.


Palette


  • --background
  • --background-muted
  • --foreground
  • --foreground-muted
  • --border
  • --link
  • --error
  • --warning


Accent


  • --accent
  • --accent-tint
  • --accent-tint-hover
  • --accent-foreground


Chrome


  • --font-family
  • --font-family-monospace
  • --border-radius-small
  • --border-radius-medium
  • --border-radius-large
  • --icon-stroke-width
  • --background-active
  • --overlay-background
  • --system-bar-background
  • --phone-bar-border
  • --box-shadow-large
  • --box-shadow-medium
  • --box-shadow-small


Editor


  • --editor-max-width
  • --editor-overlay-width
  • --editor-font-family
  • --editor-font-size
  • --editor-line-height
  • --editor-font-weight
  • --editor-background
  • --editor-foreground
  • --editor-foreground-muted
  • --editor-border
  • --editor-background-muted
  • --viewer-background


Headings


N: Heading level 1 to 6


  • --heading-font-family
  • --heading-font-weight
  • --heading-foreground
  • --heading-border
  • --heading-border-width
  • --heading-N-font-size
  • --heading-N-font-weight
  • --heading-N-foreground
  • --heading-N-padding-top
  • --heading-N-border
  • --heading-N-border-width


Document


  • --highlight-background
  • --markup-foreground
  • --hr-border
  • --blockquote-foreground
  • --blockquote-font-style
  • --blockquote-border
  • --blockquote-border-width
  • --code-font-family
  • --code-font-size
  • --code-background
  • --code-inline-background
  • --code-border
  • --properties-background
  • --properties-border
  • --table-font-size
  • --table-border
  • --table-header-background
  • --table-header-font-weight
  • --table-striped-row-background


Syntax


  • --syntax-keyword
  • --syntax-string
  • --syntax-number
  • --syntax-function
  • --syntax-constant
  • --syntax-type
  • --syntax-comment


TeX


  • --tex-title-font-size
  • --tex-title-font-weight
  • --tex-title-line-height
  • --tex-author-font-size
  • --tex-date-font-size
  • --tex-date-foreground
  • --tex-caption-font-size
  • --tex-caption-font-style
  • --tex-caption-foreground
  • --tex-script-font-size


Classes


The classes name the parts of the window. They can change when the window does, and the changelog says when.


Window


  • .deft-app
  • .deft-touch
  • .deft-phone
  • .deft-chrome-hidden
  • .deft-workspace
  • .deft-sidebar
  • .deft-sidebar-left
  • .deft-sidebar-right
  • .deft-toolbar
  • .deft-spacer
  • .deft-statusbar
  • .deft-sync-footer
  • .deft-main
  • .deft-editor
  • .deft-editor-buttons


Note


  • .deft-breadcrumbs
  • .deft-note-title
  • .deft-viewer-bar
  • .deft-viewer-bar.docked


File tree


  • .deft-tree
  • .deft-tree.drag-over
  • .deft-tree-row
  • .deft-tree-row.selected
  • .deft-tree-row.drag-over
  • .deft-tree-folder
  • .deft-tree-project
  • .deft-tree-file


Panels


  • .deft-panel
  • .deft-outline
  • .deft-backlinks
  • .deft-tasks
  • .deft-bookmarks
  • .deft-problems
  • .deft-panel-item
  • .deft-panel-item.active
  • .deft-panel-item.done
  • .deft-panel-group
  • .deft-empty


Controls


  • .deft-tab
  • .deft-tab.active
  • .deft-icon-button
  • .deft-icon-button.active
  • .deft-button
  • .deft-button-primary
  • .deft-button-filled
  • .deft-input


Popovers and modals


  • .deft-popover
  • .deft-find
  • .deft-menu
  • .deft-menu-item
  • .deft-modal
  • .deft-settings
  • .deft-settings-page
  • .deft-search