Skip to content

Commit 917d952

Browse files
authored
Add social media brand colors pack (Closes #471) (#520)
* Create brand colors props. (Closes #471) * Update package-lock.json * Export .css file for brand props * Add showcase, code and demo for brand colors props to docsite. * Update brotli bundled size for brand colors props. * Change internal name for `brand` to `brand-colors`. * Change internal name for `brand` to `brand-colors` in `package.json`. * Inline previously client-side generated HTML for brand colors in docsite. * Uh...
1 parent 6d8ced3 commit 917d952

File tree

9 files changed

+128
-4
lines changed

9 files changed

+128
-4
lines changed

build/props.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import SVG from '../src/props.svg.js'
1717
import Zindex from '../src/props.zindex.js'
1818
import MaskEdges from '../src/props.masks.edges.js'
1919
import MaskCornerCuts from '../src/props.masks.corner-cuts.js'
20+
import BrandColors from '../src/props.brand-colors.js'
2021

2122
import {buildPropsStylesheet} from './to-stylesheet.js'
2223
import {toTokens} from './to-tokens.js'
@@ -148,6 +149,11 @@ buildPropsStylesheet({
148149
{selector, prefix}
149150
)
150151

152+
buildPropsStylesheet(
153+
{filename: pfx + 'props.brand-colors.css', props: BrandColors},
154+
{selector, prefix}
155+
)
156+
151157
// gen index.css
152158
const entry = fs.createWriteStream(`../src/${pfx}index.css`)
153159
entry.write(`@import 'props.media.css';

docsite/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@import "../src/props.gray-hsl.css";
66
@import "../src/props.masks.edges.css";
77
@import "../src/props.masks.corner-cuts.css";
8+
@import "../src/props.brand-colors.css";
89

910
@import "./syntax-highlight.css";
1011
@import "./color-copy.css";

docsite/index.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,11 @@ <h4>File Sizes</h4>
526526
<div class="file">
527527
<a href="https://github.com/argyleink/open-props/blob/main/src/props.zindex.css">zindex.css</a>
528528
</div>
529+
530+
<div class="size"><strong>0.30</strong>kB</div>
531+
<div class="file">
532+
<a href="https://github.com/argyleink/open-props/blob/main/src/props.brand-colors.css">brand-colors.css</a> <a href="https://codepen.io/aspizu/pen/LYwNeyz"><small class="green-badge">demo</small></a>
533+
</div>
529534
</dd>
530535
</div>
531536

@@ -1679,6 +1684,34 @@ <h4>Jungle</h4>
16791684
</ul>
16801685
</article>
16811686

1687+
<header>
1688+
<h2>Brand Colors</h2>
1689+
<div class="block-wrap">
1690+
<p>Various brand colors.</p>
1691+
<blockquote class="icon-quote jagged">
1692+
<svg viewBox="0 0 24 24" stroke="currentColor" fill="none">
1693+
<path
1694+
d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" />
1695+
</svg>
1696+
<span>Not part of the main bundle. Must be individually imported.</span>
1697+
</blockquote>
1698+
</div>
1699+
</header>
1700+
<div class="block-wrap">
1701+
<div>
1702+
<h5>NPM Imported Usage Sample</h5>
1703+
<pre class="language-css"><code>@import "open-props/brand-colors";
1704+
1705+
.facebook-logo {
1706+
fill: var(--brand-facebook);
1707+
}</code></pre>
1708+
</div>
1709+
</div>
1710+
<article class="just-stretch">
1711+
<!-- bun run docsite/js/brand-colors.js -->
1712+
<ul class="open-colors count-em color-swatch-list"><h4> facebook</h4><li><button class="color-swatch" style="background-color: var(--brand-facebook)" aria-label=" facebook"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> youtube</h4><li><button class="color-swatch" style="background-color: var(--brand-youtube)" aria-label=" youtube"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> twitter</h4><li><button class="color-swatch" style="background-color: var(--brand-twitter)" aria-label=" twitter"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> whatsapp</h4><li><button class="color-swatch" style="background-color: var(--brand-whatsapp)" aria-label=" whatsapp"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> instagram yellow</h4><li><button class="color-swatch" style="background-color: var(--brand-instagram-yellow)" aria-label=" instagram yellow"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> instagram red</h4><li><button class="color-swatch" style="background-color: var(--brand-instagram-red)" aria-label=" instagram red"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> instagram magenta</h4><li><button class="color-swatch" style="background-color: var(--brand-instagram-magenta)" aria-label=" instagram magenta"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> instagram blue</h4><li><button class="color-swatch" style="background-color: var(--brand-instagram-blue)" aria-label=" instagram blue"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> snapchat</h4><li><button class="color-swatch" style="background-color: var(--brand-snapchat)" aria-label=" snapchat"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> google blue</h4><li><button class="color-swatch" style="background-color: var(--brand-google-blue)" aria-label=" google blue"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> google red</h4><li><button class="color-swatch" style="background-color: var(--brand-google-red)" aria-label=" google red"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> google yellow</h4><li><button class="color-swatch" style="background-color: var(--brand-google-yellow)" aria-label=" google yellow"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> google green</h4><li><button class="color-swatch" style="background-color: var(--brand-google-green)" aria-label=" google green"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> tiktok razzmatazz</h4><li><button class="color-swatch" style="background-color: var(--brand-tiktok-razzmatazz)" aria-label=" tiktok razzmatazz"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> tiktok splash</h4><li><button class="color-swatch" style="background-color: var(--brand-tiktok-splash)" aria-label=" tiktok splash"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> microsoft red</h4><li><button class="color-swatch" style="background-color: var(--brand-microsoft-red)" aria-label=" microsoft red"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> microsoft green</h4><li><button class="color-swatch" style="background-color: var(--brand-microsoft-green)" aria-label=" microsoft green"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> microsoft blue</h4><li><button class="color-swatch" style="background-color: var(--brand-microsoft-blue)" aria-label=" microsoft blue"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> microsoft yellow</h4><li><button class="color-swatch" style="background-color: var(--brand-microsoft-yellow)" aria-label=" microsoft yellow"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> pinterest</h4><li><button class="color-swatch" style="background-color: var(--brand-pinterest)" aria-label=" pinterest"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> spotify</h4><li><button class="color-swatch" style="background-color: var(--brand-spotify)" aria-label=" spotify"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> discord</h4><li><button class="color-swatch" style="background-color: var(--brand-discord)" aria-label=" discord"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> telegram</h4><li><button class="color-swatch" style="background-color: var(--brand-telegram)" aria-label=" telegram"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> reddit</h4><li><button class="color-swatch" style="background-color: var(--brand-reddit)" aria-label=" reddit"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> amazon</h4><li><button class="color-swatch" style="background-color: var(--brand-amazon)" aria-label=" amazon"></button></li></ul><ul class="open-colors count-em color-swatch-list"><h4> twitch</h4><li><button class="color-swatch" style="background-color: var(--brand-twitch)" aria-label=" twitch"></button></li></ul>
1713+
</article>
1714+
16821715
<details>
16831716
<summary>Color Theming 101</summary>
16841717

docsite/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ import '/js/slider.js'
77
import '/js/scrollspy.js'
88
import '/js/select.js'
99

10-
import '/js/color-copy.js'
10+
import '/js/color-copy.js'

docsite/js/brand-colors.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
console.log(
2+
Object.keys(import('../../src/props.brand-colors.js'))
3+
.map((brand) => [brand.replace(/-/g, ' ').replace('brand ', ''), brand])
4+
.map(
5+
([brandTitlecase, brand]) =>
6+
`<ul class="open-colors count-em color-swatch-list"><h4>${brandTitlecase}</h4><li><button class="color-swatch" style="background-color: var(${brand})" aria-label="${brandTitlecase}"></button></li></ul>`
7+
)
8+
.join('')
9+
)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"./src/zindex": "./src/props.zindex.js",
4545
"./src/masks.edges": "./src/props.masks.edges.js",
4646
"./src/masks.corner-cuts": "./src/props.masks.corner-cuts.js",
47+
"./src/brand-colors": "./src/props.brand-colors.js",
4748
"./style": "./open-props.min.css",
4849
"./postcss/style": "./src/index.css",
4950
"./normalize": "./normalize.min.css",
@@ -116,6 +117,7 @@
116117
"./yellow": "./yellow.min.css",
117118
"./yellow-hsl": "./yellow-hsl.min.css",
118119
"./zindex": "./zindex.min.css",
120+
"./brand-colors": "./brand-colors.min.css",
119121
"./shadow/style": "./open-props.shadow.min.css",
120122
"./shadow/normalize": "./normalize.shadow.min.css",
121123
"./shadow/animations": "./animations.shadow.min.css",
@@ -310,7 +312,8 @@
310312
"shadow:colors:camo": "postcss src/shadow.props.camo.css -o camo.shadow.min.css",
311313
"shadow:colors:camo-hsl": "postcss src/shadow.props.camo-hsl.css -o camo-hsl.shadow.min.css",
312314
"shadow:colors:jungle": "postcss src/shadow.props.jungle.css -o jungle.shadow.min.css",
313-
"shadow:colors:jungle-hsl": "postcss src/shadow.props.jungle-hsl.css -o jungle-hsl.shadow.min.css"
315+
"shadow:colors:jungle-hsl": "postcss src/shadow.props.jungle-hsl.css -o jungle-hsl.shadow.min.css",
316+
"lib:brand-colors": "postcss src/props.brand-colors.css -o brand-colors.min.css"
314317
},
315318
"devDependencies": {
316319
"ava": "^3.15.0",

src/props.brand-colors.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
:where(html) {
2+
--brand-facebook: #0866FF;
3+
--brand-youtube: #FF0000;
4+
--brand-twitter: #469CF0;
5+
--brand-whatsapp: #25D366;
6+
--brand-instagram-yellow: #F8D648;
7+
--brand-instagram-red: #E93365;
8+
--brand-instagram-magenta: #D32DBF;
9+
--brand-instagram-blue: #611EF5;
10+
--brand-snapchat: #FFFC00;
11+
--brand-google-blue: #4285F4;
12+
--brand-google-red: #DB4437;
13+
--brand-google-yellow: #F4B400;
14+
--brand-google-green: #0F9D58;
15+
--brand-tiktok-razzmatazz: #FE2C55;
16+
--brand-tiktok-splash: #25F4EE;
17+
--brand-microsoft-red: #F25022;
18+
--brand-microsoft-green: #7FBA00;
19+
--brand-microsoft-blue: #00A4EF;
20+
--brand-microsoft-yellow: #FFB900;
21+
--brand-pinterest: #E60023;
22+
--brand-spotify: #1ED760;
23+
--brand-discord: #5865F2;
24+
--brand-telegram: #2AABEE;
25+
--brand-reddit: #FF4500;
26+
--brand-amazon: #232F3E;
27+
--brand-twitch: #9146FF;
28+
}

src/props.brand-colors.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
export default {
2+
// source: https://about.meta.com/brand/resources/facebook/logo/
3+
'--brand-facebook': '#0866FF',
4+
// source: https://www.youtube.com/intl/ALL_in/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors
5+
'--brand-youtube': '#FF0000',
6+
// source: https://about.twitter.com/content/dam/about-twitter/en/brand-toolkit/downloads/twitter-external-brand-guidelines-01272021.pdf
7+
'--brand-twitter': '#469CF0',
8+
// source: https://about.meta.com/brand/resources/whatsapp/whatsapp-brand/
9+
'--brand-whatsapp': '#25D366',
10+
// source: https://about.meta.com/brand/resources/instagram/instagram-brand/
11+
'--brand-instagram-yellow': '#F8D648',
12+
'--brand-instagram-red': '#E93365',
13+
'--brand-instagram-magenta': '#D32DBF',
14+
'--brand-instagram-blue': '#611EF5',
15+
// source: https://snap.com/en-US/brand-guidelines
16+
'--brand-snapchat': '#FFFC00',
17+
// source: https://usbrandcolors.com/google-colors/
18+
'--brand-google-blue': '#4285F4',
19+
'--brand-google-red': '#DB4437',
20+
'--brand-google-yellow': '#F4B400',
21+
'--brand-google-green': '#0F9D58',
22+
// source: https://tiktokbrandbook.com/d/HhXfjVK1Poj9/brand-guidelines#/basics/color/core-palette
23+
'--brand-tiktok-razzmatazz': '#FE2C55',
24+
'--brand-tiktok-splash': '#25F4EE',
25+
// source: https://cdn-dynmedia-1.microsoft.com/is/content/microsoftcorp/microsoft/mscle/documents/presentations/CELA_ThirdPartyLogoGuidelines_June2021.pdf
26+
'--brand-microsoft-red': '#F25022',
27+
'--brand-microsoft-green': '#7FBA00',
28+
'--brand-microsoft-blue': '#00A4EF',
29+
'--brand-microsoft-yellow': '#FFB900',
30+
// source: https://usbrandcolors.com/pinterest-colors/
31+
'--brand-pinterest': '#E60023',
32+
// source: https://developer.spotify.com/documentation/design#using-our-colors
33+
'--brand-spotify': '#1ED760',
34+
// source: https://discord.com/branding
35+
'--brand-discord': '#5865F2',
36+
// source: https://telegram.org/tour/screenshots
37+
'--brand-telegram': '#2AABEE',
38+
// source: https://reddit.lingoapp.com/s/Color-R7y72J/?v=22
39+
'--brand-reddit': '#FF4500',
40+
// source: none
41+
'--brand-amazon': '#232F3E',
42+
// source: https://brand.twitch.com/
43+
'--brand-twitch': '#9146FF',
44+
}

0 commit comments

Comments
 (0)