@ttoss/theme 2.6.2 → 2.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +178 -2
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,9 +1,185 @@
1
1
  # @ttoss/theme
2
2
 
3
- **@ttoss/theme** is an theme package.
3
+ Pre-built themes and theme creation utilities for the [ttoss Design System](https://ttoss.dev/docs/design/design-system). Provides complete visual personalities for React applications using [design tokens](https://ttoss.dev/docs/design/design-system/design-tokens) and Theme UI integration.
4
4
 
5
- ## Install
5
+ ## Installation
6
6
 
7
7
  ```shell
8
8
  pnpm add @ttoss/theme @ttoss/react-icons
9
9
  ```
10
+
11
+ ## Quick Start
12
+
13
+ ### 1. Use Pre-built Theme
14
+
15
+ ```tsx
16
+ import { ThemeProvider } from '@ttoss/ui';
17
+ import { BruttalTheme } from '@ttoss/theme/Bruttal';
18
+
19
+ export const App = () => (
20
+ <ThemeProvider theme={BruttalTheme}>
21
+ <YourAppContent />
22
+ </ThemeProvider>
23
+ );
24
+ ```
25
+
26
+ ### 2. Create Custom Theme
27
+
28
+ ```tsx
29
+ import { createTheme } from '@ttoss/theme';
30
+
31
+ export const MyTheme = createTheme({
32
+ colors: {
33
+ primary: '#007acc',
34
+ secondary: '#6c757d',
35
+ background: '#ffffff',
36
+ text: '#212529',
37
+ },
38
+ fonts: {
39
+ body: '"Inter", sans-serif',
40
+ heading: '"Poppins", sans-serif',
41
+ },
42
+ });
43
+ ```
44
+
45
+ ## Available Themes
46
+
47
+ ### Bruttal Theme
48
+
49
+ **Bold, high-contrast design with sharp aesthetics**
50
+
51
+ ```tsx
52
+ import { BruttalTheme, BruttalFonts, BrutalIcons } from '@ttoss/theme/Bruttal';
53
+
54
+ // Complete theme with semantic tokens
55
+ <ThemeProvider theme={BruttalTheme}>
56
+
57
+ // Typography: Atkinson Hyperlegible, Work Sans
58
+ // Colors: Deep charcoal (#292C2a), bright blue (#0469E3)
59
+ // Style: Minimal border radius, sharp corners
60
+ ```
61
+
62
+ ### Oca Theme
63
+
64
+ **Soft, friendly design with rounded elements**
65
+
66
+ ```tsx
67
+ import { OcaTheme, OcaFonts, OcaIcons } from '@ttoss/theme/Oca';
68
+
69
+ // Soft contrasts and warm palette
70
+ <ThemeProvider theme={OcaTheme}>
71
+
72
+ // Typography: Source Sans Pro, approachable fonts
73
+ // Colors: Soft black (#111827), bright green (#03FF7A)
74
+ // Style: Generous border radius, comfortable spacing
75
+ ```
76
+
77
+ ### Default Theme
78
+
79
+ **Foundation theme with core tokens only**
80
+
81
+ ```tsx
82
+ import { defaultTheme } from '@ttoss/theme/default';
83
+
84
+ // Base tokens without semantic mapping
85
+ // Use as foundation for custom themes
86
+ ```
87
+
88
+ ## Theme Structure
89
+
90
+ Each theme provides:
91
+
92
+ - **Core Tokens**: Colors, typography, spacing, sizing
93
+ - **Semantic Tokens**: Context-specific token mappings (action, navigation, feedback)
94
+ - **Component Styles**: Pre-configured component variants
95
+ - **Global Styles**: Base styles for HTML elements
96
+ - **Font Integration**: Web font loading and fallbacks
97
+ - **Icon Integration**: Icon library configuration
98
+
99
+ ## API Reference
100
+
101
+ ### `createTheme(theme, base?)`
102
+
103
+ Creates a new theme by merging configuration with a base theme.
104
+
105
+ ```tsx
106
+ import { createTheme, defaultTheme } from '@ttoss/theme';
107
+
108
+ const customTheme = createTheme(
109
+ {
110
+ // Your theme overrides
111
+ colors: { primary: '#custom-color' },
112
+ },
113
+ defaultTheme
114
+ ); // Optional base theme
115
+ ```
116
+
117
+ **Parameters:**
118
+
119
+ - `theme: Theme` - Theme configuration object
120
+ - `base?: Theme` - Base theme to extend (defaults to `defaultTheme`)
121
+
122
+ **Returns:** Complete `Theme` object for use with `ThemeProvider`
123
+
124
+ ## Advanced Usage
125
+
126
+ ### Custom Theme Development
127
+
128
+ ```tsx
129
+ import { createTheme } from '@ttoss/theme';
130
+
131
+ export const BrandTheme = createTheme({
132
+ // 1. Define core brand values
133
+ colors: {
134
+ primary: '#your-brand-primary',
135
+ secondary: '#your-brand-secondary',
136
+ },
137
+
138
+ // 2. Configure semantic tokens
139
+ colors: {
140
+ action: {
141
+ background: {
142
+ primary: { default: 'primary' },
143
+ secondary: { default: 'secondary' },
144
+ },
145
+ },
146
+ },
147
+
148
+ // 3. Customize component styles
149
+ buttons: {
150
+ primary: {
151
+ backgroundColor: 'action.background.primary.default',
152
+ borderRadius: 'lg',
153
+ },
154
+ },
155
+ });
156
+ ```
157
+
158
+ ### Font and Icon Integration
159
+
160
+ ```tsx
161
+ import { BruttalTheme, BruttalFonts } from '@ttoss/theme/Bruttal';
162
+
163
+ // Fonts are automatically loaded when using pre-built themes
164
+ // For custom themes, handle font loading separately
165
+
166
+ export const App = () => (
167
+ <ThemeProvider theme={BruttalTheme} fonts={BruttalFonts}>
168
+ <YourApp />
169
+ </ThemeProvider>
170
+ );
171
+ ```
172
+
173
+ ## Integration
174
+
175
+ - **Design System**: Core part of [ttoss Design System](https://ttoss.dev/docs/design/design-system)
176
+ - **Component Library**: Used by [@ttoss/ui](https://ttoss.dev/docs/modules/packages/ui) components
177
+ - **Design Tokens**: Implements [semantic token](https://ttoss.dev/docs/design/design-system/design-tokens/semantic-tokens) architecture
178
+ - **Theme UI**: Built on [Theme UI](https://theme-ui.com/) specification
179
+ - **TypeScript**: Full type safety and IntelliSense support
180
+
181
+ ## Related Packages
182
+
183
+ - **[@ttoss/ui](https://ttoss.dev/docs/modules/packages/ui)**: React component library that consumes themes
184
+ - **[@ttoss/react-icons](https://ttoss.dev/docs/modules/packages/react-icons)**: Icon library integration
185
+ - **[Design System Documentation](https://ttoss.dev/docs/design/design-system)**: Complete design system guide
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/theme",
3
- "version": "2.6.2",
3
+ "version": "2.6.3",
4
4
  "description": "Theme for packages.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -35,7 +35,7 @@
35
35
  "deepmerge": "^4.3.1"
36
36
  },
37
37
  "peerDependencies": {
38
- "@ttoss/react-icons": "^0.4.13"
38
+ "@ttoss/react-icons": "^0.4.14"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@iconify/icons-carbon": "^1.2.20",
@@ -44,9 +44,9 @@
44
44
  "jest": "^30.0.4",
45
45
  "theme-ui": "^0.17.1",
46
46
  "tsup": "^8.5.0",
47
+ "@ttoss/react-icons": "^0.4.14",
47
48
  "@ttoss/config": "^1.35.5",
48
- "@ttoss/test-utils": "^2.1.25",
49
- "@ttoss/react-icons": "^0.4.13"
49
+ "@ttoss/test-utils": "^2.1.25"
50
50
  },
51
51
  "keywords": [],
52
52
  "publishConfig": {