"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([["1279"],{818:function(e,t,s){s.r(t),s.d(t,{default:()=>f,frontMatter:()=>d,metadata:()=>o,assets:()=>m,toc:()=>u,contentTitle:()=>h});var o=JSON.parse('{"id":"features/themes","title":"Themes","description":"LiveCodes comes with dark and light themes. In addition, a theme color can be set to change the app color.","source":"@site/docs/features/themes.mdx","sourceDirName":"features","slug":"/features/themes","permalink":"/docs/features/themes","draft":false,"unlisted":false,"editUrl":"https://github.com/live-codes/livecodes/tree/develop/docs/docs/features/themes.mdx","tags":[],"version":"current","frontMatter":{},"sidebar":"docsSidebar","previous":{"title":"Default View","permalink":"/docs/features/default-view"},"next":{"title":"Mobile Support","permalink":"/docs/features/mobile"}}'),n=s("5893"),r=s("65"),i=s("4200"),a=s("7294"),l=s("3365");function c(){let{colorMode:e}=(0,i.I)(),t=[{name:"blue",themeColor:"lightblue"},{name:"cyan",themeColor:"hsl(192, 40%, 50%)"},{name:"green",themeColor:"rgb(77, 179, 114)"},{name:"amber",themeColor:"#b38d4d"},{name:"red",themeColor:"hsl(0, 40%, 50%)"},{name:"violet",themeColor:"rgb(114, 77, 179)"},{name:"slate",themeColor:"#667799"}],[s,o]=(0,a.useState)(e),[r,c]=(0,a.useState)(t[0].themeColor);return(0,n.jsxs)("form",{className:"form_bM8e",children:[(0,n.jsxs)("p",{children:["Theme:",(0,n.jsx)("input",{type:"radio",name:"theme",id:"light-theme",checked:"light"===s,onChange:()=>o("light")}),(0,n.jsx)("label",{htmlFor:"light-theme",children:"Light"}),(0,n.jsx)("input",{type:"radio",name:"theme",id:"dark-theme",checked:"dark"===s,onChange:()=>o("dark")}),(0,n.jsx)("label",{htmlFor:"dark-theme",children:"Dark"})]}),(0,n.jsxs)("p",{children:["Theme Color:",(0,n.jsx)("select",{name:"themeColor",id:"",onChange:e=>c(e.target.value),children:t.map(e=>{let{name:t,themeColor:s}=e;return(0,n.jsx)("option",{value:s,children:t},t)})})," ",(0,n.jsxs)("span",{className:"colorValue_LfXD",children:['"',r,'"']})]}),(0,n.jsx)(l.Z,{showCode:!1,config:{theme:s,themeColor:r},template:"react"})]})}let d={},h="Themes",m={},u=[{value:"Theme",id:"theme",level:2},{value:"Theme Color",id:"theme-color",level:2},{value:"Demo",id:"demo",level:2}];function p(e){let t={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",header:"header",img:"img",li:"li",p:"p",ul:"ul",...(0,r.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.header,{children:(0,n.jsx)(t.h1,{id:"themes",children:"Themes"})}),"\n","\n",(0,n.jsx)(t.p,{children:"LiveCodes comes with dark and light themes. In addition, a theme color can be set to change the app color."}),"\n",(0,n.jsx)(t.h2,{id:"theme",children:"Theme"}),"\n",(0,n.jsx)(t.p,{children:"Dark/Light theme can be set in:"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"UI, either:"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:"Dark/Light theme switch in toolbar"}),"\n",(0,n.jsx)(t.li,{children:"Settings menu \u2192 Dark theme switch"}),"\n"]}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.a,{href:"/docs/configuration/query-params",children:"Query params"}),": ",(0,n.jsx)(t.code,{children:"?theme=dark"})," or ",(0,n.jsx)(t.code,{children:"?theme=light"}),".\ne.g. ",(0,n.jsx)(t.a,{href:"https://livecodes.io/?theme=light",children:"https://livecodes.io/?theme=light"})]}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.a,{href:"/docs/configuration/configuration-object",children:"Configuration object"}),": ",(0,n.jsx)(t.a,{href:"/docs/configuration/configuration-object#theme",children:(0,n.jsx)(t.code,{children:"theme"})})," property."]}),"\n"]}),"\n"]}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.img,{alt:"LiveCodes dark theme",src:s(3279).Z+"",width:"2240",height:"1400"})}),"\n",(0,n.jsx)("div",{className:"caption",children:"LiveCodes dark theme"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.img,{alt:"LiveCodes light theme",src:s(1851).Z+"",width:"2240",height:"1400"})}),"\n",(0,n.jsx)("div",{className:"caption",children:"LiveCodes light theme"}),"\n",(0,n.jsx)(t.h2,{id:"theme-color",children:"Theme Color"}),"\n",(0,n.jsx)(t.p,{children:"Similarly, a theme color can be set in:"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsx)(t.p,{children:"UI: Settings menu \u2192 Color"}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.a,{href:"/docs/configuration/query-params",children:"Query params"}),": ",(0,n.jsx)(t.code,{children:"?themeColor={color}"}),".\ne.g. ",(0,n.jsx)(t.a,{href:"https://livecodes.io/?themeColor=lightblue",children:"https://livecodes.io/?themeColor=lightblue"})]}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:["\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.a,{href:"/docs/configuration/configuration-object",children:"Configuration object"}),": ",(0,n.jsx)(t.a,{href:"/docs/configuration/configuration-object#themecolor",children:(0,n.jsx)(t.code,{children:"themeColor"})})," property."]}),"\n"]}),"\n"]}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.img,{alt:"LiveCodes alternate theme color",src:s(5995).Z+"",width:"2240",height:"1400"})}),"\n",(0,n.jsx)("div",{className:"caption",children:"Change theme color from UI"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.img,{alt:"LiveCodes custom theme color",src:s(3638).Z+"",width:"2240",height:"1400"})}),"\n",(0,n.jsx)("div",{className:"caption",children:"Custom theme color"}),"\n",(0,n.jsx)(t.h2,{id:"demo",children:"Demo"}),"\n",(0,n.jsx)(c,{}),"\n",(0,n.jsx)(t.admonition,{title:"Note",type:"info",children:(0,n.jsxs)(t.p,{children:["Please note that editor themes can be set in the ",(0,n.jsx)(t.a,{href:"/docs/features/editor-settings",children:"editor settings"})," or using the ",(0,n.jsx)(t.a,{href:"/docs/configuration/configuration-object#editortheme",children:(0,n.jsx)(t.code,{children:"editorTheme"})})," configuration option."]})})]})}function f(e={}){let{wrapper:t}={...(0,r.a)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},3279:function(e,t,s){s.d(t,{Z:function(){return o}});let o=s.p+"assets/images/themes-1-c184a5ea8687727b1a0e690c8a465e02.jpg"},1851:function(e,t,s){s.d(t,{Z:function(){return o}});let o=s.p+"assets/images/themes-2-c08826d8eea2d618912b9b65e4898833.jpg"},5995:function(e,t,s){s.d(t,{Z:function(){return o}});let o=s.p+"assets/images/themes-3-75f2639c1c01a2a3db35cd2f86721d42.jpg"},3638:function(e,t,s){s.d(t,{Z:function(){return o}});let o=s.p+"assets/images/themes-4-18b621d69d0ddf788b1cb33d87885cae.jpg"},3365:function(e,t,s){s.d(t,{Z:()=>g});var o=s("5893"),n=s("4200"),r=s("7294"),i=s("8294");function a(e){let t=(0,r.useRef)(null),[s,n]=(0,r.useState)(e.className||""),[a,l]=(0,r.useState)(e.style||{}),[c,d]=(0,r.useState)(e.height),[h,m]=(0,r.useState)(),[u,p]=(0,r.useState)(JSON.stringify(e.config||"")),[f,g]=(0,r.useState)("");return(0,r.useEffect)(()=>{if(!t.current)return;let{className:s,style:o,height:r,sdkReady:a,config:c,...j}=e;if(n(s||""),l(o||{}),d(r),h&&f===JSON.stringify(j)){if(u===JSON.stringify(c))return;p(JSON.stringify(c)),"string"==typeof c?fetch(c).then(e=>e.json()).then(e=>{h?.setConfig(e)}):c&&h.setConfig(c)}else g(JSON.stringify(j)),h?.destroy(),(0,i.T)(t.current,{config:c,...j}).then(e=>{m(e),"function"==typeof a&&a(e)})},[e]),(0,r.useEffect)(()=>()=>{h?.destroy()},[]),(0,o.jsx)("div",{ref:t,className:s,style:a,"data-height":c})}var l=s("1858"),c=s("3262"),d=s("1705"),h=s("7645"),m=s("8168"),u=s("8228"),p=s("5050");function f(e){let[t,s]=(0,r.useState)(e.js),[n,i]=(0,r.useState)(e.ts),[a,l]=(0,r.useState)(e.react),[f,g]=(0,r.useState)(e.vue),[j,v]=(0,r.useState)(e.svelte),y="3.7rem",[x,b]=(0,r.useState)(!0),[w,C]=(0,r.useState)(y),S=(0,r.useRef)(null),k=()=>{setTimeout(()=>{C(`calc(${S.current.offsetHeight}px + ${y})`)},5),setTimeout(()=>{C(`calc(${S.current.offsetHeight}px + ${y})`)},255)};return(0,r.useEffect)(()=>{if(c.Z.canUseDOM){let e=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"js";try{return window.prettier?.format(e,{parser:"html"===t?"html":"babel",plugins:window.prettierPlugins})}catch{return e}};s(e(t,"js")),i(e(n,"ts")),l(e(a,"jsx")),g(e(f,"html")),v(e(j,"html"))}},[]),(0,o.jsxs)("details",{className:`alert alert--info ${p.Z.details} ${u.Z.details}`,"data-collapsed":x,style:{height:x?y:w,overflow:"hidden",willChange:"height",transition:`height ${x?"250ms":"265ms"} ease-in-out 0s`,margin:"1em 0"},children:[(0,o.jsx)("summary",{onClick:()=>{b(!x),k()},children:"show code"}),(0,o.jsx)("div",{ref:S,style:{display:"block",overflow:"hidden"},children:(0,o.jsx)("div",{className:p.Z.collapsibleContent,children:(0,o.jsxs)(m.Z,{groupId:"sdk-code",children:[(0,o.jsx)(h.Z,{value:"js",label:"JS",attributes:{onMouseDown:k},children:(0,o.jsx)(d.Z,{language:"js",children:t})}),(0,o.jsx)(h.Z,{value:"ts",label:"TS",attributes:{onMouseDown:k},children:(0,o.jsx)(d.Z,{language:"ts",children:n})}),(0,o.jsx)(h.Z,{value:"react",label:"React",attributes:{onMouseDown:k},children:(0,o.jsx)(d.Z,{language:"jsx",children:a})}),(0,o.jsx)(h.Z,{value:"vue",label:"Vue",attributes:{onMouseDown:k},children:(0,o.jsx)(d.Z,{language:"html",children:f})}),(0,o.jsx)(h.Z,{value:"svelte",label:"Svelte",attributes:{onMouseDown:k},children:(0,o.jsx)(d.Z,{language:"html",children:j})})]})})})]})}function g(e){let{className:t,style:s,showCode:r,height:i,...c}=e,{colorMode:d}=(0,n.I)(),h=e=>JSON.stringify(e,null,2),m=`
import { createPlayground } from 'livecodes';
const options = ${h(c)};
createPlayground('#container', options);
`.trimStart(),u=`
import { createPlayground, type EmbedOptions } from 'livecodes';
const options: EmbedOptions = ${h(c)};
createPlayground('#container', options);
`.trimStart(),p=`
import LiveCodes from 'livecodes/react';
export default function App() {
const options = ${h(c)};
return (