@@ -39,10 +39,12 @@ export default {
3939
4040### Custom Configuration
4141
42- ``` js
42+ You can customize the plugin behavior by passing an options object to ` pluginFullscreen() ` :
43+
44+ ``` js title="ec.config.mjs"
4345import { pluginFullscreen } from ' expressive-code-fullscreen' ;
4446
45- export default {
47+ export default defineEcConfig ( {
4648 plugins: [
4749 pluginFullscreen ({
4850 enabled: true ,
@@ -51,17 +53,11 @@ export default {
5153 exitOnBrowserBack: true ,
5254 addToUntitledBlocks: true ,
5355 animationDuration: 300 ,
54- theme: {
55- containerBg: ' rgba(0, 0, 0, 0.85)' ,
56- toolbarBg: ' rgba(90, 88, 88, 0.95)' ,
57- buttonBg: ' rgba(58, 57, 57, 0.9)' ,
58- buttonBgHover: ' rgba(120, 120, 120, 0.5)' ,
59- buttonText: ' #ffffff' ,
60- buttonFocus: ' rgba(74, 144, 226, 0.6)'
61- },
56+ svgPathFullscreenOn: ' M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z' ,
57+ svgPathFullscreenOff: ' M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z' ,
6258 }),
6359 ],
64- };
60+ }) ;
6561```
6662
6763### Custom SVG Icons
@@ -86,16 +82,6 @@ pluginFullscreen({
8682 enableEscapeKey: true ,
8783 exitOnBrowserBack: true ,
8884 animationDuration: 250 ,
89- theme: {
90- // Match your site's design system.
91- containerBg: ' rgba(var(--sl-color-bg), 0.95)' ,
92- buttonBg: ' rgba(var(--sl-color-accent), 0.9)' ,
93- buttonText: ' var(--sl-color-white)' ,
94- toolbarBg: ' rgba(var(--sl-color-bg-nav), 0.95)' ,
95- toolbarBorder: ' rgba(var(--sl-color-gray-5), 0.3)' ,
96- buttonBorder: ' rgba(var(--sl-color-gray-5), 0.2)' ,
97- buttonFocus: ' rgba(var(--sl-color-accent), 0.6)' ,
98- }
9985})
10086```
10187
@@ -110,24 +96,7 @@ The fullscreen button will appear in the top-right corner of your code blocks, p
11096
11197# Fullscreen Plugin Theming System
11298
113- The Expressive Code Fullscreen Plugin now includes a comprehensive theming system that allows you to customize all visual aspects of the fullscreen interface.
114-
115- ## Quick Start
116-
117- ``` javascript
118- import { pluginFullscreen } from ' expressive-code-fullscreen' ;
119-
120- // Use the plugin with custom theme
121- const fullscreenPlugin = pluginFullscreen ({
122- theme: {
123- toolbarBg: ' rgba(30, 30, 30, 0.95)' ,
124- buttonBg: ' rgba(20, 20, 20, 0.9)' ,
125- buttonBgHover: ' rgba(45, 45, 45, 0.9)' ,
126- buttonText: ' #e0e0e0' ,
127- // ... other theme options.
128- }
129- });
130- ```
99+ You can override the default styles in your Expressive Code config using the ` styleOverrides.fullscreen ` object if you want to change the colors, fonts, or other styles of the fullscreen plugin.
131100
132101## Available Theme Options
133102
@@ -177,105 +146,80 @@ const fullscreenPlugin = pluginFullscreen({
177146 - Default: ` 'rgba(255, 255, 255, 0.2)' `
178147
179148
180- ## CSS Custom Properties
181-
182- The theming system generates CSS custom properties that you can also override directly in your CSS:
183-
184- ``` css
185- :root {
186- --cb-fs-toolbar-bg : your-custom-color;
187- --cb-fs-toolbar-border : your-border-color;
188- --cb-fs-button-bg : your-button-color;
189- --cb-fs-button-bg-hover : your-hover-color;
190- --cb-fs-button-bg-active : your-active-color;
191- --cb-fs-button-text : your-text-color;
192- --cb-fs-button-border : your-button-border;
193- --cb-fs-button-focus : your-focus-color;
194- --cb-fs-container-bg : your-container-bg;
195- --cb-fs-content-shadow : your-shadow-color;
196- --cb-fs-hint-bg : your-hint-bg;
197- --cb-fs-hint-text : your-hint-text;
198- --cb-fs-hint-border : your-hint-border;
199- }
200- ```
201-
202- ## Theme Examples
149+ ## Quick Start
203150
204- ### Dark Blue Theme
205151``` javascript
206- pluginFullscreen ({
207- theme: {
208- toolbarBg: ' rgba(25, 39, 52, 0.95)' ,
209- toolbarBorder: ' rgba(100, 149, 237, 0.3)' ,
210- buttonBg: ' rgba(15, 29, 42, 0.9)' ,
211- buttonBgHover: ' rgba(35, 49, 62, 0.9)' ,
212- buttonBgActive: ' rgba(5, 19, 32, 0.9)' ,
213- buttonText: ' #e6f3ff' ,
214- buttonBorder: ' rgba(100, 149, 237, 0.4)' ,
215- buttonFocus: ' rgba(100, 149, 237, 0.8)' ,
216- containerBg: ' rgba(10, 25, 41, 0.9)' ,
217- contentShadow: ' rgba(0, 20, 40, 0.6)' ,
218- hintBg: ' rgba(15, 29, 42, 0.95)' ,
219- hintText: ' #e6f3ff' ,
220- hintBorder: ' rgba(100, 149, 237, 0.3)' ,
152+ {
153+ plugins: [pluginFullscreen ()],
154+ styleOverrides: {
155+ fullscreen: {
156+ toolbarBg: ' rgba(30, 30, 30, 0.95)' ,
157+ buttonBg: ' rgba(20, 20, 20, 0.9)' ,
158+ buttonBgHover: ' rgba(45, 45, 45, 0.9)' ,
159+ buttonText: ' #e0e0e0' ,
160+ // ... other theme options
161+ }
221162 }
222- })
163+ }
223164```
224165
225- ### Light Theme
226- ``` javascript
227- pluginFullscreen ({
228- theme: {
229- toolbarBg: ' rgba(248, 249, 250, 0.95)' ,
230- toolbarBorder: ' rgba(0, 0, 0, 0.1)' ,
231- buttonBg: ' rgba(255, 255, 255, 0.9)' ,
232- buttonBgHover: ' rgba(243, 244, 246, 0.9)' ,
233- buttonBgActive: ' rgba(229, 231, 235, 0.9)' ,
234- buttonText: ' #374151' ,
235- buttonBorder: ' rgba(0, 0, 0, 0.2)' ,
236- buttonFocus: ' rgba(59, 130, 246, 0.6)' ,
237- containerBg: ' rgba(255, 255, 255, 0.95)' ,
238- contentShadow: ' rgba(0, 0, 0, 0.1)' ,
239- hintBg: ' rgba(255, 255, 255, 0.95)' ,
240- hintText: ' #374151' ,
241- hintBorder: ' rgba(0, 0, 0, 0.1)' ,
242- }
243- })
244- ```
166+ ## Complete Theme Configuration Example
167+
168+ Here's a complete example showing all available theme options with their default values:
245169
246- ### Custom Brand Colors
247170``` javascript
248- pluginFullscreen ({
249- theme: {
250- toolbarBg: ' rgba(67, 56, 202, 0.95)' ,
251- buttonBg: ' rgba(99, 102, 241, 0.9)' ,
252- buttonBgHover: ' rgba(129, 140, 248, 0.9)' ,
253- buttonText: ' #ffffff' ,
254- buttonFocus: ' rgba(168, 85, 247, 0.6)' ,
255- containerBg: ' rgba(30, 27, 75, 0.9)' ,
256- hintBg: ' rgba(67, 56, 202, 0.95)' ,
171+ {
172+ plugins: [pluginFullscreen ()],
173+ styleOverrides: {
174+ fullscreen: {
175+ // Toolbar styling.
176+ toolbarBg: ' rgba(90, 88, 88, 0.95)' ,
177+ toolbarBorder: ' rgba(255, 255, 255, 0.1)' ,
178+
179+ // Button styling.
180+ buttonBg: ' rgba(58, 57, 57, 0.9)' ,
181+ buttonBgHover: ' rgba(120, 120, 120, 0.5)' ,
182+ buttonBgActive: ' rgba(25, 25, 25, 0.9)' ,
183+ buttonText: ' #ffffff' ,
184+ buttonBorder: ' rgba(255, 255, 255, 0.2)' ,
185+ buttonFocus: ' rgba(74, 144, 226, 0.6)' ,
186+
187+ // Container and effects.
188+ containerBg: ' rgba(0, 0, 0, 0.85)' ,
189+ contentShadow: ' rgba(0, 0, 0, 0.5)' ,
190+
191+ // Hints and tooltips.
192+ hintBg: ' rgba(20, 20, 20, 0.95)' ,
193+ hintText: ' #ffffff' ,
194+ hintBorder: ' rgba(255, 255, 255, 0.2)' ,
195+ }
257196 }
258- })
197+ }
259198```
260199
261- ### Purple Theme
200+ ### Custom Theme Example
201+
262202``` javascript
263- pluginFullscreen ({
264- theme: {
265- toolbarBg: ' rgba(76, 29, 149, 0.95)' ,
266- toolbarBorder: ' rgba(167, 139, 250, 0.3)' ,
267- buttonBg: ' rgba(59, 7, 100, 0.9)' ,
268- buttonBgHover: ' rgba(91, 33, 182, 0.9)' ,
269- buttonBgActive: ' rgba(49, 7, 90, 0.9)' ,
270- buttonText: ' #f3e8ff' ,
271- buttonBorder: ' rgba(167, 139, 250, 0.4)' ,
272- buttonFocus: ' rgba(167, 139, 250, 0.8)' ,
273- containerBg: ' rgba(35, 7, 70, 0.9)' ,
274- contentShadow: ' rgba(76, 29, 149, 0.4)' ,
275- hintBg: ' rgba(59, 7, 100, 0.95)' ,
276- hintText: ' #f3e8ff' ,
277- hintBorder: ' rgba(167, 139, 250, 0.3)' ,
203+ {
204+ plugins: [pluginFullscreen ()],
205+ styleOverrides: {
206+ fullscreen: {
207+ // Dark blue theme.
208+ toolbarBg: ' rgba(25, 39, 52, 0.95)' ,
209+ toolbarBorder: ' rgba(100, 149, 237, 0.3)' ,
210+ buttonBg: ' rgba(15, 29, 42, 0.9)' ,
211+ buttonBgHover: ' rgba(35, 49, 62, 0.9)' ,
212+ buttonBgActive: ' rgba(5, 19, 32, 0.9)' ,
213+ buttonText: ' #e6f3ff' ,
214+ buttonBorder: ' rgba(100, 149, 237, 0.4)' ,
215+ buttonFocus: ' rgba(100, 149, 237, 0.8)' ,
216+ containerBg: ' rgba(10, 25, 41, 0.9)' ,
217+ contentShadow: ' rgba(0, 20, 40, 0.6)' ,
218+ hintBg: ' rgba(15, 29, 42, 0.95)' ,
219+ hintText: ' #e6f3ff' ,
220+ hintBorder: ' rgba(100, 149, 237, 0.3)' ,
221+ }
278222 }
279- })
223+ }
280224```
281225
0 commit comments