Skip to content

Commit

Permalink
Merge pull request #2146 from AmruthPillai/feat/custom-css
Browse files Browse the repository at this point in the history
Implement Custom CSS Feature
  • Loading branch information
AmruthPillai authored Jan 13, 2025
2 parents 7fb0226 + eab996f commit a5dc15d
Show file tree
Hide file tree
Showing 23 changed files with 463 additions and 17 deletions.
8 changes: 7 additions & 1 deletion apps/artboard/src/pages/artboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,11 @@ export const ArtboardPage = () => {
}
}, [metadata]);

return <Outlet />;
return (
<>
{metadata.css.visible && <style lang="css">{`[data-page] { ${metadata.css.value} }`}</style>}

<Outlet />
</>
);
};
155 changes: 155 additions & 0 deletions apps/client/public/styles/prism-dark.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
code[class*="language-"],
pre[class*="language-"] {
color: #f8f8f2;
background: none;
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;

-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;

-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}

/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: 0.5em 0;
overflow: auto;
border-radius: 0.3em;
}

:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #2b2b2b;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
padding: 0.1em;
border-radius: 0.3em;
white-space: normal;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #d4d0ab;
}

.token.punctuation {
color: #fefefe;
}

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
color: #ffa07a;
}

.token.boolean,
.token.number {
color: #00e0e0;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #abe338;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
color: #00e0e0;
}

.token.atrule,
.token.attr-value,
.token.function {
color: #ffd700;
}

.token.keyword {
color: #00e0e0;
}

.token.regex,
.token.important {
color: #ffd700;
}

.token.important,
.token.bold {
font-weight: bold;
}

.token.italic {
font-style: italic;
}

.token.entity {
cursor: help;
}

@media screen and (forced-colors: active) {
code[class*="language-"],
pre[class*="language-"] {
color: windowText;
background: window;
}

:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: window;
}

.token.important {
background: highlight;
color: window;
font-weight: normal;
}

.token.atrule,
.token.attr-value,
.token.function,
.token.keyword,
.token.operator,
.token.selector {
font-weight: bold;
}

.token.attr-value,
.token.comment,
.token.doctype,
.token.function,
.token.keyword,
.token.operator,
.token.property,
.token.string {
color: highlight;
}

.token.attr-value,
.token.url {
font-weight: normal;
}
}
167 changes: 167 additions & 0 deletions apps/client/public/styles/prism-light.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
code[class*="language-"],
pre[class*="language-"] {
color: #393a34;
font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
font-size: 0.9em;
line-height: 1.2em;

-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;

-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}

pre > code[class*="language-"] {
font-size: 1em;
}

pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection {
background: #c1def1;
}

pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
background: #c1def1;
}

/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: 0.5em 0;
overflow: auto;
border: 1px solid #dddddd;
background-color: white;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
padding: 0.2em;
padding-top: 1px;
padding-bottom: 1px;
background: #f8f8f8;
border: 1px solid #dddddd;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #008000;
font-style: italic;
}

.token.namespace {
opacity: 0.7;
}

.token.string {
color: #a31515;
}

.token.punctuation,
.token.operator {
color: #393a34; /* no highlight */
}

.token.url,
.token.symbol,
.token.number,
.token.boolean,
.token.variable,
.token.constant,
.token.inserted {
color: #36acaa;
}

.token.atrule,
.token.keyword,
.token.attr-value,
.language-autohotkey .token.selector,
.language-json .token.boolean,
.language-json .token.number,
code[class*="language-css"] {
color: #0000ff;
}

.token.function {
color: #393a34;
}

.token.deleted,
.language-autohotkey .token.tag {
color: #9a050f;
}

.token.selector,
.language-autohotkey .token.keyword {
color: #00009f;
}

.token.important {
color: #e90;
}

.token.important,
.token.bold {
font-weight: bold;
}

.token.italic {
font-style: italic;
}

.token.class-name,
.language-json .token.property {
color: #2b91af;
}

.token.tag,
.token.selector {
color: #800000;
}

.token.attr-name,
.token.property,
.token.regex,
.token.entity {
color: #ff0000;
}

.token.directive.tag .tag {
background: #ffff00;
color: #393a34;
}

/* overrides color-values for the Line Numbers plugin
* http://prismjs.com/plugins/line-numbers/
*/
.line-numbers.line-numbers .line-numbers-rows {
border-right-color: #a5a5a5;
}

.line-numbers .line-numbers-rows > span:before {
color: #2b91af;
}

/* overrides color-values for the Line Highlight plugin
* http://prismjs.com/plugins/line-highlight/
*/
.line-highlight.line-highlight {
background: rgba(193, 222, 241, 0.2);
background: -webkit-linear-gradient(left, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0));
background: linear-gradient(to right, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0));
}
2 changes: 1 addition & 1 deletion apps/client/public/templates/json/azurill.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
]
],
"css": {
"value": ".section {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"value": "* {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"visible": false
},
"page": {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/public/templates/json/bronzor.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
]
],
"css": {
"value": ".section {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"value": "* {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"visible": false
},
"page": {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/public/templates/json/chikorita.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
]
],
"css": {
"value": ".section {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"value": "* {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"visible": false
},
"page": {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/public/templates/json/ditto.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
]
],
"css": {
"value": ".section {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"value": "* {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"visible": false
},
"page": {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/public/templates/json/gengar.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
[[], []]
],
"css": {
"value": ".section {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"value": "* {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"visible": false
},
"page": {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/public/templates/json/glalie.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
]
],
"css": {
"value": ".section {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"value": "* {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"visible": false
},
"page": {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/public/templates/json/kakuna.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
]
],
"css": {
"value": ".section {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"value": "* {\n\toutline: 1px solid #000;\n\toutline-offset: 4px;\n}",
"visible": false
},
"page": {
Expand Down
Loading

0 comments on commit a5dc15d

Please sign in to comment.