Skip to main content
Scratch uses a two-tier settings system:
  1. App Config - Stored in {APP_DATA}/config.json - Contains notes folder path
  2. Per-Folder Settings - Stored in {NOTES_FOLDER}/.scratch/settings.json - All other settings
This allows different settings for different notes folders (e.g., work vs personal).

App Config

Stored in platform-specific app data directory:
  • macOS: ~/Library/Application Support/com.erictli.scratch/config.json
  • Windows: %APPDATA%\com.erictli.scratch\config.json
  • Linux: ~/.local/share/com.erictli.scratch/config.json

AppConfig Schema

pub struct AppConfig {
    pub notes_folder: Option<String>,
}
notes_folder
string | null
Absolute path to the notes folder. Null if not configured (first launch).

Example

{
  "notes_folder": "/Users/username/Documents/Notes"
}

Per-Folder Settings

Stored in {NOTES_FOLDER}/.scratch/settings.json. These settings are specific to each notes folder.

Settings Schema

pub struct Settings {
    pub theme: ThemeSettings,
    pub editor_font: Option<EditorFontSettings>,
    pub git_enabled: Option<bool>,
    pub pinned_note_ids: Option<Vec<String>>,
    pub text_direction: Option<String>,
    pub editor_width: Option<String>,
    pub default_note_name: Option<String>,
    pub interface_zoom: Option<f32>,
}

theme

Theme and color customization settings.
theme.mode
string
default:"system"
Theme mode: "light", "dark", or "system" (follows OS preference)
theme.customLightColors
ThemeColors | null
default:"null"
Custom color overrides for light mode. If null, uses default colors.
theme.customDarkColors
ThemeColors | null
default:"null"
Custom color overrides for dark mode. If null, uses default colors.

ThemeColors Schema

pub struct ThemeColors {
    pub bg: Option<String>,              // Background
    pub bg_secondary: Option<String>,    // Secondary background (sidebar)
    pub bg_muted: Option<String>,        // Muted background (hover states)
    pub bg_emphasis: Option<String>,     // Emphasis background (selected items)
    pub text: Option<String>,            // Primary text color
    pub text_muted: Option<String>,      // Muted text (timestamps, previews)
    pub text_inverse: Option<String>,    // Inverse text (buttons)
    pub border: Option<String>,          // Border color
    pub accent: Option<String>,          // Accent color (links, buttons)
}
All color fields accept CSS color values (hex, rgb, hsl).

editorFont

Editor typography settings.
editorFont.baseFontFamily
string | null
default:"null"
Font family preset:
  • "system-sans" - System sans-serif font
  • "serif" - Serif font (Georgia-based)
  • "monospace" - Monospace font (for code)
If null, uses default (system sans).
editorFont.baseFontSize
number | null
default:"16"
Base font size in pixels. Range: 12-24. Default: 16.
editorFont.boldWeight
number | null
default:"700"
Font weight for bold text and headings:
  • 600 - Semibold
  • 700 - Bold (default)
  • 800 - Extra bold
editorFont.lineHeight
number | null
default:"1.6"
Line height multiplier. Range: 1.2-2.0. Default: 1.6.

gitEnabled

gitEnabled
boolean | null
default:"false"
Whether to show Git status and commit UI in sidebar. If null, defaults to false.

pinnedNoteIds

pinnedNoteIds
string[] | null
default:"null"
Array of note IDs to pin to the top of the note list. Pinned notes are sorted by modification date among themselves, then all unpinned notes follow.

textDirection

textDirection
string | null
default:"ltr"
Text direction for editor:
  • "ltr" - Left-to-right (default)
  • "rtl" - Right-to-left (for Arabic, Hebrew, etc.)

editorWidth

editorWidth
string | null
default:"normal"
Editor content width:
  • "narrow" - ~600px (for focused reading)
  • "normal" - ~750px (default)
  • "wide" - ~900px
  • "full" - 100% width (uses all available space)

defaultNoteName

defaultNoteName
string | null
default:"Untitled"
Template for new note filenames. Supports template tags:
  • {timestamp} - Unix timestamp (e.g., 1234567890)
  • {date} - YYYY-MM-DD
  • {year} - YYYY
  • {month} - MM
  • {day} - DD
  • {time} - HH-MM-SS (dashes for filename safety)
  • {counter} - Auto-incrementing number (1, 2, 3, …)
Examples:
  • "Note {date}""Note 2024-03-15.md"
  • "{year}/{month}/{day}""2024/03/15.md" (creates nested folders)
  • "Meeting {counter}""Meeting 1.md", "Meeting 2.md"

interfaceZoom

interfaceZoom
number | null
default:"1.0"
UI zoom level. Range: 0.5-2.0. Default: 1.0 (100%).Affects entire interface including sidebar, editor, and dialogs.

Default Settings

When a new notes folder is selected, Scratch creates a default settings.json:
{
  "theme": {
    "mode": "system",
    "customLightColors": null,
    "customDarkColors": null
  },
  "editorFont": null,
  "gitEnabled": null,
  "pinnedNoteIds": null,
  "textDirection": null,
  "editorWidth": null,
  "defaultNoteName": null,
  "interfaceZoom": null
}
Note: Fields set to null use their documented default values.

Complete Example

Example settings.json with custom theme, typography, and Git enabled:
{
  "theme": {
    "mode": "dark",
    "customLightColors": null,
    "customDarkColors": {
      "bg": "#1a1a1a",
      "bgSecondary": "#252525",
      "bgMuted": "#303030",
      "bgEmphasis": "#3a3a3a",
      "text": "#e0e0e0",
      "textMuted": "#a0a0a0",
      "textInverse": "#ffffff",
      "border": "#404040",
      "accent": "#4a9eff"
    }
  },
  "editorFont": {
    "baseFontFamily": "serif",
    "baseFontSize": 18,
    "boldWeight": 700,
    "lineHeight": 1.8
  },
  "gitEnabled": true,
  "pinnedNoteIds": [
    "important-note",
    "work/project-plan"
  ],
  "textDirection": "ltr",
  "editorWidth": "wide",
  "defaultNoteName": "Note {date}",
  "interfaceZoom": 1.1
}

Programmatic Access

Get Settings

import { invoke } from '@tauri-apps/api/core';

const settings = await invoke<Settings>('get_settings');
console.log(settings.theme.mode); // "light" | "dark" | "system"

Update Settings

import { invoke } from '@tauri-apps/api/core';

// Read current settings
const settings = await invoke<Settings>('get_settings');

// Modify settings
settings.theme.mode = 'dark';
settings.gitEnabled = true;

// Save back
await invoke('update_settings', { newSettings: settings });
Important: Always read settings first, modify the object, then save. The update_settings command replaces the entire settings object.

UI Customization

Settings are exposed in the UI:
  1. Settings Page - Settings → General, Appearance tabs
    • Theme mode switcher
    • Font family, size, line height, bold weight pickers
    • Text direction toggle
    • Editor width selector
    • Default note name template input
    • Git integration toggle
  2. Direct JSON Editing - For advanced users
    • Open {NOTES_FOLDER}/.scratch/settings.json in a text editor
    • Edit JSON directly (supports custom colors)
    • Restart Scratch to apply changes

Color Customization

Custom colors are not exposed in the UI to keep the settings simple. Power users can edit settings.json directly:
{
  "theme": {
    "mode": "dark",
    "customDarkColors": {
      "bg": "#1e1b2e",
      "bgSecondary": "#2a2740",
      "bgMuted": "#352f50",
      "bgEmphasis": "#3d3556",
      "text": "#e0def4",
      "textMuted": "#908caa",
      "textInverse": "#ffffff",
      "border": "#3d3556",
      "accent": "#c4a7e7"
    }
  }
}
{
  "theme": {
    "mode": "light",
    "customLightColors": {
      "bg": "#ffffff",
      "bgSecondary": "#f5f5f5",
      "bgMuted": "#e8e8e8",
      "bgEmphasis": "#d0d0d0",
      "text": "#000000",
      "textMuted": "#555555",
      "textInverse": "#ffffff",
      "border": "#cccccc",
      "accent": "#0066cc"
    }
  }
}

Migration Notes

v0.4.x → v0.5.x

  • Added defaultNoteName template support
  • Added interfaceZoom for UI scaling
  • Deprecated: none

v0.3.x → v0.4.x

  • Changed editorFont from flat structure to nested object
  • Added textDirection and editorWidth settings
  • Old settings are not migrated automatically

See Also

Build docs developers (and LLMs) love