-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4df78c
commit d4333d5
Showing
9 changed files
with
266 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#syntax .description { | ||
padding: var(--rh-space-lg, 16px); | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: var(--rh-space-lg, 16px); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import StyleDictionary from 'style-dictionary'; | ||
const { fileHeader } = StyleDictionary.formatHelpers; | ||
import { isColor, isSyntax } from '../predicates.js'; | ||
|
||
/** | ||
* Prism Syntax CSS | ||
* @type {import('style-dictionary').Format} | ||
*/ | ||
export const prismCss = { | ||
name: 'css/prism', | ||
formatter: ({ file, dictionary }) => [ | ||
fileHeader({ file }), | ||
dictionary | ||
.allTokens | ||
.filter(isColor) | ||
.filter(isSyntax) | ||
.map(x => `.token.${x.name | ||
.replace(/rh-color-syntax-([-\w])/, '$1') | ||
.replace(/-on-(light|dark)$/, '')}{color:var(--${x.name},${x.value});}`).join('\n') | ||
].join('\n'), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
```html | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>HTML</title> | ||
<link rel="stylesheet" href="/styles.css"> | ||
</head> | ||
<body> | ||
<header> | ||
<h1>Tags</h1> | ||
</header> | ||
<main> | ||
<p class="class-name">Text</p> | ||
</main> | ||
</body> | ||
</html> | ||
``` | ||
|
||
```typescript | ||
@customElement('rh-jazz-hands') | ||
export class RhJazzHands extends LitElement { | ||
@colorContextConsumer() private on: ColorTheme = 'light'; | ||
|
||
render() { | ||
const { on } = this; | ||
return html` | ||
<slot id="container" class=${classMap({ [on]: !!on })></slot> | ||
`; | ||
} | ||
} | ||
``` | ||
```css | ||
@container (--context: dark) { | ||
:host(:has(rh-cta)) { | ||
border-color: var(--rh-color-border-interactive-on-dark, #73bcf7); | ||
} | ||
} | ||
``` | ||
```bash | ||
# !/bin/bash | ||
source_prefix=$1 | ||
suffix=$2 | ||
destination_prefix=$3 | ||
for i in $(ls ${source_prefix}*.${suffix});do | ||
mv $i $(echo $i | sed s/${source_prefix}/${destination_prefix}/) | ||
done | ||
``` | ||
```go | ||
package main | ||
import "fmt" | ||
func main() { | ||
fmt.Println("Hello, 世界") | ||
} | ||
``` | ||
```rust | ||
trait Animal { | ||
// Associated function signature; `Self` refers to the implementor type. | ||
fn new(name: &'static str) -> Self; | ||
// Method signatures; these will return a string. | ||
fn name(&self) -> &'static str; | ||
fn noise(&self) -> &'static str; | ||
// Traits can provide default method definitions. | ||
fn talk(&self) { | ||
println!("{} says {}", self.name(), self.noise()); | ||
} | ||
} | ||
``` | ||
```json | ||
{ | ||
"color": { | ||
"$type": "color", | ||
"accent": { | ||
"base": { | ||
"on-light": { | ||
"$name": "rh-color-accent-base-on-light", | ||
"$description": "Inline link (light theme)", | ||
"$value": "#0066cc" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
color: | ||
syntax: | ||
$extensions: | ||
com.redhat.ux: | ||
heading: Syntax Highlighting | ||
descriptionFile: syntax.md | ||
|
||
# atrule: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
attr-name: | ||
on-light: | ||
$value: '{color.orange.500}' | ||
|
||
attr-value: | ||
on-light: | ||
$value: '{color.orange.500}' | ||
|
||
boolean: | ||
on-light: | ||
$value: '{color.orange.500}' | ||
|
||
# builtin: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
# cdata: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
# char: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
class-name: | ||
on-light: | ||
$value: '{color.green.600}' | ||
|
||
comment: | ||
on-light: | ||
$value: '{color.black.500}' | ||
|
||
constant: | ||
on-light: | ||
$value: '{color.purple.500}' | ||
|
||
# deleted: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
# doctype: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
# entity: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
function: | ||
on-light: | ||
$value: '{color.red.500}' | ||
|
||
# important: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
# inserted: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
keyword: | ||
on-light: | ||
$value: '{color.purple.500}' | ||
|
||
# namespace: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
number: | ||
on-light: | ||
$value: '{color.orange.500}' | ||
|
||
operator: | ||
on-light: | ||
$value: '{color.cyan.500}' | ||
|
||
# prolog: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
property: | ||
on-light: | ||
$value: '{color.blue.500}' | ||
|
||
punctuation: | ||
on-light: | ||
$value: '{color.blue.500}' | ||
|
||
regex: | ||
on-light: | ||
$value: '{color.red.500}' | ||
|
||
# selector: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
string: | ||
on-light: | ||
$value: '{color.green.500}' | ||
|
||
symbol: | ||
on-light: | ||
$value: '{color.green.500}' | ||
|
||
tag: | ||
on-light: | ||
$value: '{color.orange.500}' | ||
|
||
# url: | ||
# on-light: | ||
# $value: '{color.}' | ||
|
||
variable: | ||
on-light: | ||
$value: '{color.purple.500}' | ||
|