Skip to content

Commit

Permalink
customize feather buttons, mainly for dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
willnorris committed Aug 28, 2021
1 parent a5090c0 commit 3912bde
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
60 changes: 60 additions & 0 deletions assets/css/_feather-custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@media (prefers-color-scheme: dark) {
/* feather buttons */
.Button,
.Button:visited {
background-color: black;
border: 1px solid var(--tw-color-blue-primary);
color: var(--tw-color-blue-primary);
}
.Button:focus,
.Button.is-focus {
background: black;
border-color: var(--tw-color-blue-primary);
color: var(--tw-color-blue-primary);
}
.Button:hover,
.Button.is-hover {
background-color: var(--tw-color-gray-900-experimental);
border-color: var(--tw-color-blue-primary);
color: var(--tw-color-blue-primary);
}
.Button:active,
.Button.is-active {
background-color: var(--tw-color-gray-900-experimental);
border-color: var(--tw-color-blue-primary);
color: var(--tw-color-blue-primary);
}

.Button.Button--tertiary,
.Button.Button--tertiary:visited,
.ButtonGroup--tertiary > .Button,
.ButtonGroup--tertiary > .Button:visited {
background-color: black;
border: 1px solid var(--tw-color-blue-primary);
color: #1DA1F2;
}
.Button.Button--tertiary:focus,
.Button.Button--tertiary.is-focus,
.ButtonGroup--tertiary > .Button:focus,
.ButtonGroup--tertiary > .Button.is-focus {
background-color: black;
border: 1px solid var(--tw-color-blue-primary);
color: var(--tw-color-blue-primary);
}
.Button.Button--tertiary:hover,
.Button.Button--tertiary.is-hover,
.ButtonGroup--tertiary > .Button:hover,
.ButtonGroup--tertiary > .Button.is-hover {
background-color: var(--tw-color-gray-900-experimental);
border-color: var(--tw-color-blue-primary);
color: var(--tw-color-blue-primary);
}
.Button.Button--tertiary:active,
.Button.Button--tertiary.is-active,
.ButtonGroup--tertiary > .Button:active,
.ButtonGroup--tertiary > .Button.is-active {
background-color: var(--tw-color-gray-900-experimental);
border-color: var(--tw-color-blue-primary);
color: var(--tw-color-blue-primary);
}
}
3 changes: 3 additions & 0 deletions assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
@import "feather-component-button";
@import "feather-component-grid";

// custom feather overrides
@import "feather-custom";

@import "main";
4 changes: 2 additions & 2 deletions content/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h1 class="center-text medium-margin">Love</h1>
<div class="Grid-cell left-text u-size5of12 u-after1of12">
<h1 class="small-title mega-margin">Explore Projects</h1>
<p class="mega-margin">Twitter has been built on open source since the beginning. Openness is part of our DNA. The projects you see here were born at Twitter, and patches are always welcome!</p>
<a href="/projects/" class="Button Button--large">View All Projects</a>
<a href="/projects/" class="Button Button--primary Button--large">View All Projects</a>
</div>
<div class="Grid-cell explore-projects-blank"></div>
</div>
Expand All @@ -81,7 +81,7 @@ <h1 class="small-title mega-margin">Explore Projects</h1>
<div id="career-text" class="Grid-cell left-text u-size5of12 u-after1of12 same-mega-margin">
<h1 class="small-title mega-margin career-title">Join the Flock</h1>
<p class="mega-margin">We are always on the lookout for innovative and creative individuals who are passionate about building a platform where all voices can be heard.</p>
<a href="https://careers.twitter.com" class="Button Button--large">View All Careers</a>
<a href="https://careers.twitter.com" class="Button Button-primary Button--large">View All Careers</a>
</div>
<div class="Grid-cell timeline-cell u-size1of2">
<a class="twitter-timeline" data-height="700px" data-partner="tweetdeck" href="https://twitter.com/TwitterOSS/timelines/1028044487681925121?ref_src=twsrc%5Etfw">#TwitterOSSJobs - Curated tweets by TwitterOSS</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Expand Down
1 change: 1 addition & 0 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function lessThan800px(mediaQuery) {

// set dark theme on twitter timeline widgets and feather components
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
document.getElementsByTagName('body')[0].classList.add("u-featherBackgroundDark");
for (const e of document.getElementsByClassName('twitter-timeline')) {
e.setAttribute('data-theme','dark');
}
Expand Down

0 comments on commit 3912bde

Please sign in to comment.