Addon Categories

Themes

Create custom visual themes, color palettes, and styles for the Mr. Tick interface.

Themes (Visual Customization)

Themes addons customize Mr. Tick's appearance with color palettes for Light and Dark modes, contrast, borders, and typography.

Mr. Tick uses a design system based on CSS Tokens, compatible with Tailwind CSS and shadcn/ui, so creating themes is simple and declarative.


🎨 Theme Structure

A theme exports an AddonTheme definition containing its CSS, compatible with Tailwind CSS / shadcn/ui variables:

export interface AddonTheme {
  id: string
  name: string
  description?: string
  css: string
}

💻 Theme Implementation Example

1. manifest.yaml

id: cyberpunk-theme
name: Cyberpunk Neon Theme
version: 1.0.0
description: Tema com estética cyberpunk e cores neon vibrantes
categories:
  - theme
author: Sua Empresa <contato@empresa.com>

2. src/index.ts

import type {
  AddonActionResponse,
  AddonContext,
  AddonTheme,
  IAddon,
} from '@mr-tick/sdk'

export const CYBERPUNK_THEME: AddonTheme = {
  id: 'cyberpunk-theme',
  name: 'Cyberpunk Neon',
  description: 'Paleta neon com tons rosa e ciano vibrantes.',
  css: `
    :root {
      --background: 0 0% 100%;
      --foreground: 240 10% 3.9%;
      --primary: 326 100% 50%;
    }
    .dark {
      --background: 260 25% 8%;
      --foreground: 180 100% 95%;
      --primary: 180 100% 50%;
    }
  `,
}

export default class CyberpunkThemeAddon implements IAddon {
  private activeContext: AddonContext | null = null

  public activate(context: AddonContext): void {
    this.activeContext = context

    // 1. Registra o tema no sistema
    context.contributions.themes.register(CYBERPUNK_THEME)

    // 2. Registra a tela de configuração com botões de ação
    context.contributions.settings.register([
      {
        id: 'general',
        label: 'Geral',
        groups: [
          {
            id: 'theme_controls',
            label: 'Controles do Tema',
            fields: [
              {
                id: 'apply-theme',
                type: 'button',
                label: 'Ativar Tema Cyberpunk',
                actionId: 'apply-theme',
              },
              {
                id: 'reset-theme',
                type: 'button',
                label: 'Restaurar Tema Padrão',
                variant: 'destructive',
                actionId: 'reset-theme',
              },
            ],
          },
        ],
      },
    ])

    // 3. Registra os comandos das ações
    context.contributions.commands.register('apply-theme', async (): Promise<AddonActionResponse> => {
      await context.contributions.commands.execute('theme:set', CYBERPUNK_THEME.id)
      return {
        isSuccess: true,
        display: {
          title: 'Tema Cyberpunk Ativado!',
          message: 'Estilo visual aplicado com sucesso.',
        },
      }
    })

    context.contributions.commands.register('reset-theme', async (): Promise<AddonActionResponse> => {
      await context.contributions.commands.execute('theme:set', '')
      return {
        isSuccess: true,
        display: {
          title: 'Tema Padrão Restaurado!',
          message: 'Interface retornou ao padrão do Mr-tick.',
        },
      }
    })
  }

  public deactivate(): void {
    if (this.activeContext) {
      this.activeContext.themes.unregister(CYBERPUNK_THEME.id)
      this.activeContext = null
    }
  }
}

⚙️ How Mr. Tick Applies Themes

  1. When a user selects a theme in preferences, the Core dynamically injects its CSS variables into the DOM root (:root or the .dark class).
  2. All interface components (Time Bar, Task Lists, Dialogs, and Menus) update their colors immediately without reloading the window.