Skip to content

Commit f07bd98

Browse files
committed
feat: dark theme
1 parent d268310 commit f07bd98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+962
-318
lines changed

apps/vscode-extension/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# 21st.dev Extension
22

3+
## 0.5.6
4+
5+
### Patch Changes
6+
7+
- Added dark theme support for VS Code Extension
8+
- Enhanced integration with system theme preferences
9+
- Improved visual accessibility in low-light environments
10+
311
## 0.5.1
412

513
### Patch Changes

examples/react-example/src/App.tsx

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,102 @@
1-
import { useState } from 'react';
1+
import { useState, useEffect } from 'react';
22
import reactLogo from './assets/react.svg';
33
import viteLogo from '/vite.svg';
44
import './App.css';
5+
import { TwentyFirstToolbar } from '@21st-extension/toolbar-react';
56

67
function App() {
78
const [count, setCount] = useState(0);
9+
const [isDark, setIsDark] = useState(false);
810

911
const handleRuntimeError = () => {
1012
throw new Error('This is a runtime error for testing purposes');
1113
};
1214

15+
const toggleTheme = () => {
16+
if (isDark) {
17+
document.documentElement.classList.remove('dark');
18+
setIsDark(false);
19+
} else {
20+
document.documentElement.classList.add('dark');
21+
setIsDark(true);
22+
}
23+
};
24+
25+
const getCSSVariable = (varName: string) => {
26+
const anchor = document.querySelector('stagewise-companion-anchor');
27+
if (anchor) {
28+
return getComputedStyle(anchor).getPropertyValue(varName).trim();
29+
}
30+
return 'not found';
31+
};
32+
33+
const [cssVars, setCssVars] = useState<{ [key: string]: string }>({});
34+
35+
useEffect(() => {
36+
const interval = setInterval(() => {
37+
setCssVars({
38+
background: getCSSVariable('--background'),
39+
foreground: getCSSVariable('--foreground'),
40+
border: getCSSVariable('--border'),
41+
});
42+
}, 1000);
43+
44+
return () => clearInterval(interval);
45+
}, []);
46+
1347
return (
1448
<>
49+
<TwentyFirstToolbar />
1550
<div>
16-
<a href="https://vite.dev" target="_blank">
51+
<a href="https://vitejs.dev" target="_blank">
1752
<img src={viteLogo} className="logo" alt="Vite logo" />
1853
</a>
1954
<a href="https://react.dev" target="_blank">
2055
<img src={reactLogo} className="logo react" alt="React logo" />
2156
</a>
2257
</div>
2358
<h1>Vite + React</h1>
59+
60+
{/* Theme Debug Info */}
61+
<div
62+
style={{
63+
border: '1px solid #ccc',
64+
padding: '10px',
65+
margin: '20px 0',
66+
backgroundColor: '#f9f9f9',
67+
}}
68+
>
69+
<h3>Theme Debug Info:</h3>
70+
<p>Current theme: {isDark ? 'Dark' : 'Light'}</p>
71+
<p>HTML classes: {document.documentElement.className || 'none'}</p>
72+
<p>
73+
Toolbar element exists:{' '}
74+
{document.querySelector('stagewise-companion-anchor') ? 'Yes' : 'No'}
75+
</p>
76+
77+
<h4>CSS Variables:</h4>
78+
<ul>
79+
<li>--background: {cssVars.background || 'loading...'}</li>
80+
<li>--foreground: {cssVars.foreground || 'loading...'}</li>
81+
<li>--border: {cssVars.border || 'loading...'}</li>
82+
</ul>
83+
84+
<button
85+
type="button"
86+
onClick={toggleTheme}
87+
style={{
88+
padding: '8px 16px',
89+
backgroundColor: isDark ? '#333' : '#fff',
90+
color: isDark ? '#fff' : '#333',
91+
border: '1px solid #ccc',
92+
borderRadius: '4px',
93+
cursor: 'pointer',
94+
}}
95+
>
96+
Toggle Theme (Current: {isDark ? 'Dark' : 'Light'})
97+
</button>
98+
</div>
99+
24100
<div className="card">
25101
<button type="button" onClick={() => setCount((count) => count + 1)}>
26102
count is {count}

packages/create-stagewise-plugin/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# create-21st-plugin
22

3+
## 0.5.6
4+
5+
### Patch Changes
6+
7+
- Updated plugin templates with dark theme support
8+
- Enhanced scaffold templates for better dark theme integration
9+
- Added examples for theme-aware plugin development
10+
311
## 0.5.1
412

513
### Patch Changes

packages/extension-toolbar-srpc-contract/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @21st-extension/extension-toolbar-srpc-contract
22

3+
## 0.5.6
4+
5+
### Patch Changes
6+
7+
- Enhanced SRPC contract to support dark theme communication
8+
- Updated type definitions for theme-related properties
9+
- Updated dependencies
10+
- @21st-extension/srpc@0.5.6
11+
312
## 0.5.1
413

514
### Patch Changes

packages/srpc/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @21st-extension/srpc
22

3+
## 0.5.6
4+
5+
### Patch Changes
6+
7+
- Enhanced communication protocols to support dark theme preferences
8+
- Updated serialization to handle theme-related data
9+
310
## 0.5.1
411

512
### Patch Changes

packages/srpc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@21st-extension/srpc",
3-
"version": "0.2.2",
3+
"version": "0.2.3",
44
"license": "AGPL-3.0-only",
55
"type": "module",
66
"private": false,

packages/typescript-config/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @21st-extension/typescript-config
22

3+
## 0.5.6
4+
5+
### Patch Changes
6+
7+
- Enhanced TypeScript configurations for dark theme support
8+
- Updated build configurations for theme-aware development
9+
- Improved type safety for theme-related features
10+
311
## 0.5.1
412

513
### Patch Changes

packages/ui/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @21st-extension/ui
22

3+
## 0.5.6
4+
5+
### Patch Changes
6+
7+
- Added dark theme support for UI components
8+
- Enhanced component styling for both light and dark themes
9+
- Improved accessibility with better contrast ratios
10+
311
## 0.5.1
412

513
### Patch Changes

plugins/angular/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @21st-extension/angular
22

3+
## 0.5.6
4+
5+
### Patch Changes
6+
7+
- Added dark theme support for Angular plugin integration
8+
- Enhanced visual consistency with 21st.dev Toolbar dark theme
9+
- Updated dependencies
10+
- @21st-extension/toolbar@0.5.6
11+
312
## 0.5.1
413

514
### Patch Changes

plugins/angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@21st-extension/angular",
3-
"version": "0.5.5",
3+
"version": "0.5.6",
44
"type": "module",
55
"keywords": [
66
"21st-extension",

0 commit comments

Comments
 (0)