Style Settings

by mgmeyers
5
4
3
2
1
Score: 75/100

Description

The Style Settings plugin gives CSS snippets, themes and plugin styles a common way to expose user facing options in one settings pane. It reads @settings YAML blocks from loaded CSS files and turns them into controls for class toggles, dropdowns, text values, numbers, sliders and color variables. This makes theme and snippet customization easier to manage because authors can define adjustable values directly in CSS instead of building separate interfaces. It also supports grouped headings, info text, themed colors and optional commands for class toggles, so larger style packs can stay organised.

Reviews

No reviews yet.

Stats

2451
stars
2,614,227
downloads
176
forks
1,967
days
40
days
729
days
28
total PRs
1
open PRs
8
closed PRs
19
merged PRs
201
total issues
39
open issues
162
closed issues
6
commits

Latest Version

2 years ago

Changelog

f26cfa0 Upgrade libs and fix type errors 5cbf4e7 1.0.8 4ce9491 Fix #152 51a1497 Merge pull request #128 from ThePyroTF2/update_readme 6418dea Add documentation for the quotes key of the variable-text setting type

README file from

Github

Obsidian Style Settings Plugin

This plugin allows snippet, theme, and plugin CSS files to define a set of configuration options. It then allows users to see all the tweakable settings in one settings pane. Style Settings allows both toggling classes on and off the body element, as well as setting numeric, string, and color CSS variables.

This CSS Snippet can be used to adjust every CSS variable of the default Obsidian theme.

Configurable settings are defined by comments within CSS files beginning with /* @settings. These comments must contain YAML with name, id, and settings properties. Style Settings will scan for these comments in all CSS loaded by Obsidian from the snippets, themes, and plugins directories under your vault's configuration directory (%yourVault%/.obsidian/). Please see the Obsidian Docs for more information.

For example, adding this to a CSS snippet in your vault's snippets directory (%yourVault%/.obsidian/snippets):

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: my-title
        title: My Settings
        type: heading
        level: 3
    - 
        id: accent
        title: Accent Color
        type: variable-color
        format: hsl-split
        default: '#007AFF'
    - 
        id: text
        title: UI font
        description: Font used for the user interface
        type: variable-text
        default: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif

*/

will result in:

Each setting definition must be separated by a dash (-). There are 7 setting types.

All settings definitions must have these parameters:

  • id: A unique id for the setting parameter
  • title: The name of the setting
  • description (optional): a description of the setting
  • type: The type of setting. Can be one of:
    • heading: a heading element for organizing settings
    • class-toggle: a switch to toggle classes on the body element
    • class-select: a dropdown menu of predefined options to add classes on the body element
    • variable-text: a text-based CSS variable
    • variable-number: a numeric CSS variable
    • variable-number-slider: a numeric CSS variable represented by a slider
    • variable-select: a text-based CSS variable displayed as a dropdown menu of predefined options
    • variable-color: a color CSS variable with corresponding color picker

heading

headings can be used to organize and group settings into collapsable nested sections. Along with the required attributes, headings must contain a level attribute between 1 and 6, and can optionally contain a collapsed attribute:

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: this-is-a-heading
        title: My Heading
        type: heading
        level: 2
        collapsed: true

*/

info-text

info-text displays arbitrary informational text to users. The description may contain markdown if markdown is set to true.

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: my-info-text
        title: Information
        description: "This is *informational* text"
        type: info-text
        markdown: true

*/

class-toggle

class-toggles will toggle a css class on and off of the body element, allowing CSS themes and snippets to toggle features on and off. The id of the setting will be used as the class name. The default parameter can optionally be set to true. class-toggle also supports the addCommand property. When set to true a command will be added to obsidian to toggle the class via a hotkey or the command palette.

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: my-css-class
        title: My Toggle
        description: Adds my-css-class to the body element
        type: class-toggle

*/

class-select

class-select creates a dropdown of predefined options for a CSS variable. The id of the setting will be used as the variable name.

  • When allowEmpty is false, a default option must be specified.
  • When allowEmpty is true, the default attribute is optional, and may be set to none.
/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: theme-variant
        title: Theme variant
        description: Variations on a theme
        type: class-select
        allowEmpty: false
        default: my-class
        options:
            - my-class
            - my-other-class
            - and-yet-another

*/

Options may also be given a label:

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: theme-variant
        title: Theme variant
        description: Variations on a theme
        type: class-select
        allowEmpty: false
        default: my-class
        options:
            - 
                label: My Class
                value: my-class
            - 
                label: My Other Class
                value: my-other-class
*/

variable-text

variable-text represents any text based CSS value. The id of the setting will be used as the variable name. The output will be wrapped in quotes if quotes is set to true. variable-text settings require a default attribute.

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: text
        title: UI font
        description: Font used for the user interface
        type: variable-text
        default: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif

*/

This will output the variable:

--text: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;

Using quotes:

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    -
        id: icon
        title: Bullet Icon
        description: Text used in bullet points
        type: variable-text
        default: •
        quotes: true
*/

This will output the variable:

--icon: '•'

variable-number

variable-number represents any numeric CSS value. The id of the setting will be used as the variable name. variable-number settings require a default attribute. Optionally, a format attribute can be set. This value will be appended to the number. Eg format: px will result in 42px

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: line-width
        title: Line width
        description: The maximum line width in rem units
        type: variable-number
        default: 42
        format: rem

*/

This will output the variable:

--line-width: 42rem;

variable-number-slider

variable-number-slider represents any numeric CSS value. The id of the setting will be used as the variable name. variable-number-slider settings require a default attribute, as well as these three attributes:

  • min: The minimum possible value of the slider
  • max: The maximum possible value of the slider
  • step: The size of each "tick" of the slider. For example, a step of 100 will only allow the slider to move in increments of 100.

Optionally, a format attribute can be set. This value will be appended to the number. Eg format: px will result in 42px

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: line-width
        title: Line width
        description: The maximum line width in rem units
        type: variable-number-slider
        default: 42
        min: 10
        max: 100
        step: 1

*/

This will output the variable:

--line-width: 42;

variable-select

variable-select creates a dropdown of predefined options for a CSS variable. The id of the setting will be used as the variable name. variable-select settings require a default attribute as well as a list of options.

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: text
        title: UI font
        description: Font used for the user interface
        type: variable-select
        default: Roboto
        options:
            - Roboto
            - Helvetica Neue
            - sans-serif
            - Segoe UI

*/

Options can optionally be given a label:

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: text
        title: UI font
        description: Font used for the user interface
        type: variable-select
        default: Roboto
        options:
            - 
                label: The best font
                value: Roboto
            - 
                label: The next best font
                value: Helvetica Neue
*/

This will output the variable:

--text: Roboto;

variable-color

variable-color creates a color picker with a variety of output format options. A default attribute is required in hex or rgb format. Note: hex color values must be wrapped in quotes. A format attribute is also required.

Optional parameters:

  • Setting opacity to true will enable opacity support in all output formats.
  • A list of alternate output formats can be supplied via the alt-format setting
/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: accent
        title: Accent Color
        type: variable-color
        opacity: false
        format: hex
        alt-format:
            -
                id: accent-rgb
                format: rgb
        default: '#007AFF'

*/

This will output the variable:

--accent: #007AFF;
--accent-rgb: rgb(0, 123, 255);

variable-themed-color

variable-themed-color is identical to variable-color except that it generates two color pickers for a light and dark variant.

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: accent
        title: Accent Color
        type: variable-themed-color
        format: hex
        opacity: false
        default-light: '#007AFF'
        default-dark: '#2DB253'

*/

This will output the variables:

body.theme-light.css-settings-manager { --accent: #007AFF; } 
body.theme-dark.css-settings-manager { --accent: #2DB253; }

variable-color formatting options

There are 8 formatting options:

  • hex
--accent: #007AFF;

When opacity is set to true:

--accent: #007AFFFF;
  • rgb
--accent: rgb(0, 122, 255);

When opacity is set to true:

--accent: rgba(0, 122, 255, 1);
  • rgb-values
--accent: 0, 122, 255;

When opacity is set to true:

--accent: 0, 122, 255, 1;
  • rgb-split
--accent-r: 0;
--accent-g: 122;
--accent-b: 255;

When opacity is set to true:

--accent-r: 0;
--accent-g: 122;
--accent-b: 255;
--accent-a: 1;
  • hsl
--accent: hsl(211, 100%, 50%);

When opacity is set to true:

--accent: hsla(211, 100%, 50%, 1);
  • hsl-values
--accent: 211, 100%, 50%;

When opacity is set to true:

--accent: 211, 100%, 50%, 1;
  • hsl-split
--accent-h: 211;
--accent-s: 100%;
--accent-l: 50%;

When opacity is set to true:

--accent-h: 211;
--accent-s: 100%;
--accent-l: 50%;
--accent-a: 1;
  • hsl-split-decimal
--accent-h: 211;
--accent-s: 1;
--accent-l: 0.5;

When opacity is set to true:

--accent-h: 211;
--accent-s: 1;
--accent-l: 0.5;
--accent-a: 1;

color-gradient

color-gradient outputs a fixed number of colors along a gradient between two existing color variables. A format attribute is also required. Note: The to variable must be set in style settings for the gradient to be generated. Also, gradients will only be generated using colors defined under the current style settings id.

Parameters:

  • from: The starting color, or color that will be at step 0
  • to: The ending color, or color that will be at step 100
  • step: The increment at which to output a CSS variable. For example, setting step to 10 will output --var-0, --var-10, --var-20, etc...
  • format: Can be one of: hsl, rgb, or hex;
  • pad?: When set, the number section of the variable will be padded with 0's until it contains this number of digits. For example, setting pad to 3 and step to 10 will output --var-000, --var-010, --var-020
/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    -
        id: color-base
        type: color-gradient
        from: color-base-00
        to: color-base-100
        step: 5
        pad: 2
        format: hex

*/

Plugin Support

Plugins can specify a style setting config in the plugin's CSS. Plugins must call app.workspace.trigger("parse-style-settings") when the plugin loads in order for Style Settings to be notified of CSS changes.

Localization Support

Translations for titles and descriptions can be supplied for each language Obsidian supports by using one of the following postfixes:

en: English
zh: 简体中文
zh-TW: 繁體中文
ru: Pусский
ko: 한국어
it: Italiano
id: Bahasa Indonesia
ro: Română
pt-BR: Portugues do Brasil
cz: čeština
de: Deutsch
es: Español
fr: Français
no: Norsk
pl: język polski
pt: Português
ja: 日本語
da: Dansk
uk: Український
sq: Shqip
tr: Türkçe (kısmi)
hi: हिन्दी (आंशिक)
nl: Nederlands (gedeeltelijk)
ar: العربية (جزئي)

For example:

/* @settings

name: Your Section Name Here
id: a-unique-id
settings:
    - 
        id: my-css-class
        title: My Toggle
        title.de: Mein Toggle
        title.ko: 내 토글
        description: Adds my-css-class to the body element
        description.de: Fügt my-css-class zum body-Element hinzu
        description.ko: my-css-class를 body 요소에 추가합니다.
        type: class-toggle

*/

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Snippetor
5 years ago by ebullient
An assist for creating CSS snippets for Obsidian
Settings Search
5 years ago by Jeremy Valentine
Adds a search bar to Obsidian.md's settings
Group Snippets
4 years ago by Mara-Li
Create folder of snippets to activate them in one click !
Auto Hide
4 years ago by skelato1
This Obsidian plugin enables you to collapse (and expand) the sidebar easier.
Day and Night
4 years ago by Kevin Patel
An Obsidian plugin to automatically switch between day and night themes based on a set schedule
Theme Toggler
4 years ago by larsmagnus
Toggle the theme in Obsidian's panels
Dynamic Background
4 years ago by Samuel Song
Adding dynamic background effects to the Obsidian editor
Sync Graph Settings
4 years ago by Xallt
This is a plugin for syncing graph settings (Color Groups and Search Filters) to Local Graphs
Canvas CSS class
4 years ago by Lisandra-dev
A plugin that will add a css class to your canvas & adding to each canvas the path to help personnalization
Hyphenation
4 years ago by 7596ff
Enables justified text and hyphenation
Callout Manager
3 years ago by eth-p
An Obsidian.md plugin that makes creating and configuring callouts easy.
Jelly Snippets
3 years ago by Spencer Gouw
A simple text snippets plugin for Obsidian.md. BACKUP SNIPPETS BEFORE UPDATING.
Pieces for Developers
3 years ago by Pieces For Developers
Pieces' powerful extension for Obsidian-MD that allows users to access their code snippets directly within the Obsidian workspace
Mermaid Themes
3 years ago by jvsteiner
mermaid themes for obsidian
Style Text
3 years ago by Juanjo Arranz
Apply custom CSS styles to selected text in your Obsidian Notes
CSS Editor
3 years ago by Zachatoo
Edit CSS snippets in Obsidian.
Code Styler
3 years ago by Mayuran Visakan
A plugin for Obsidian.md for styling codeblocks and inline code
HelpMate
3 years ago by TfTHacker
HelpMate for Obsidian - providing help and documentation from within Obsidian
Metadata Hider
3 years ago by Benature
Hide metadata property if its value is empty
Settings profiles
3 years ago by 4Source
This is a plugin for Obsidian (https://obsidian.md). Allows you to create various global settings profiles. You can sync them between different vaults. To keep all your settings in sync, you'll never have to manually adjust them again for every vault you have or create in the future.
Hugo codeblock highlight
2 years ago by aarol
Highlights lines in code blocks using Hugo's hl_lines syntax
VARE
2 years ago by 4Source
This is a plugin for Obsidian (https://obsidian.md). Allows you to easily manage your plugins and themes inside Obsidian.
Settings Management
2 years ago by Huajin
Manage settings options, including show enabled/disabled plugins and css, grid layout, save current plugins/css enable config for quick enable/disable, etc.
Regex Mark
2 years ago by Mara-Li
Vault Name
2 years ago by @gapmiss
An Obsidian.md plugin for customizing and displaying the vault name (title) in the side navigation file explorer, similar to pre 1.6.0 versions of Obsidian.
Explorer Hider
2 years ago by Mara-Li
Hide folder & files from the explorer using a plugin and a bit of CSS :>
Fast Text Color
2 years ago by Leon Holtmeier
Obsidian plugin to enable colored text with a custom syntax.
CSS Inlay Colors
2 years ago by Benji Grant
Show inline color hints for CSS colors in Obsidian
Snippets Manager
2 years ago by Venkatraman Dhamodaran
Snippets Manager (Text Expander) For Obsidian
CSS Inserter
2 years ago by Erika Gozar
Inserts user-defined css snippets into the selected text.
Minimal Theme Settings
6 years ago by @kepano
Settings plugin to control colors and fonts in Minimal Theme
Snippets
6 years ago by Pelao
Hotkey Helper
5 years ago by PJ Eby
Easily see and access any Obsidian plugin's options pane or hotkey assignments (including conflicts) from the Community Plugins tab
Text Snippets
5 years ago by Ariana Khitrova
Snippets plugin for obsidian
Icon Swapper
5 years ago by mgmeyers
Allows swapping out Obsidian's icons
Electron Window Tweaker
5 years ago by mgmeyers
Hide Sidebars on Window Resize
5 years ago by NomarCub, Michael Hanson
A simple Obsidian plugin to hide the sidebars when the window gets narrow.
Theme Picker
5 years ago by kenset
Snippet Commands
5 years ago by death_au
Registers custom css snippets as commands (which you can bind hotkeys to)
MySnippets
5 years ago by Chetachi
MySnippets is a plugin that adds a status bar menu allowing the user to quickly manage their snippets within the comfort of their workspace 🖌.
Auto Class
5 years ago by Nathonius
Automatically add CSS classes to notes based on file path.
Theme Design Utilities
5 years ago by pseudometa
Some utilities and Quality-of-Life features for designers of Obsidian themes.
Snippetsaurus
2 years ago by Christian Humbert
Color Folders and Files
2 years ago by Mithadon
Obsidian plugin to customize the appearance of folders and files through a context menu with color picker and style options.
Theme Controller
2 years ago by Binaris
Set when and how the themes will be displayed
Image Preview on Icon Hover
2 years ago by rama1997
Plugin for Obsidian that add image popups when hovering over various icons in the user interface
Inline Code Copy
a year ago by Hongchen Lin
Smart DayNight switcher
a year ago by Andrii Hrushetskyi
Quick Peek Sidebar
a year ago by Bradley Wyatt
Open and close the Obsidian sidebars on hover.
Rainbow-Colored Sidebar
a year ago by Kevin Woblick
Automatically color your sidebar like a rainbow. No configuration needed. 18 themes included.
Slash snippets
a year ago by echo-saurav
Insert snippet of text with slash command
UnLime
a year ago by shandyba
Obsidian Unmentioned Links toggle
Custom Theme Studio
10 months ago by @gapmiss
An Obsidian.md plugin to create and tweak custom themes with live CSS editing, element styling, and instant previews. All without leaving Obsidian.
Cliplet
10 months ago by namikaze-40p
An Obsidian plugin that serves as a clipboard and snippet manager — your own, separate from the OS clipboard.
Disable Tabs
8 months ago by David V. Kimball
Disables having more than one tab open at a time Obsidian.
Typst Mate
6 months ago by azyarashi
Render math expressions with Typst instead of MathJax in Obsidian.
Auto Math
5 months ago by Vladislav Sorokin
Auto-expand LaTeX math snippets in Obsidian — write equations faster.
Fix Tab Size
3 months ago by mnaoumov
Obsidian plugin that fixes tab size according to the settings.
Path in tab title
3 months ago by d9k
Embed HTML
2 months ago by mnaoumov
Obsidian Plugin that adds support for embedding HTML files
Apex Dashboard
2 months ago by PandoraReads
Stop switching between Obsidian notes. One page. Everything you need. Memo your thoughts, crush your todos, track your projects — and make it look incredible doing it.
Card View Mode
a month ago by yo-goto
Obsidian Card View Mode Plugin
Side-Notes
23 days ago by Fried Fishsticks
Tufte-style sidenotes for Obsidian
Community Install Manager
15 days ago by Konstantin Volobuev
Allows you to use `community-plugins.js` to search for and automatically install plugins when you launch `obsidian`.
Pinned Tabs
15 days ago by NameIsKyro
Chrome-style compact pinned tabs for Obsidian with custom icons, smooth movement, and accidental-close protection.`