Skip to content

Commit

Permalink
📝 Star History
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Oct 11, 2024
1 parent 049ef12 commit 8086f48
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions _sass/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* - $screen-lg-min = 1200px
*/
:root {
prefers-color-scheme: light;
--bg-midsection: radial-gradient(circle, rgba(0,0,0, 1) 0%, rgba(0,0,0, 0) 60%, rgba(0,0,0, 0) 100%);
--color-background: #F8FCFE;
--color-color: #000;
Expand Down Expand Up @@ -202,6 +203,7 @@

/* Variable declaration for dark mode */
[data-theme="dark"] {
prefers-color-scheme: dark;
--bg-midsection: radial-gradient(circle, rgba(255,255,255, 1) 0%, rgba(255,255,255, 0) 60%, rgba(255,255,255, 0) 100%);
--color-background: #000;
--color-color: #B5B5B5;
Expand Down Expand Up @@ -867,6 +869,8 @@ a.panel-wrapper:hover, a.panel-wrapper:active {
.panel-discord { background: rgb(115, 138, 219); }
.panel-svg { padding: 1em; }

#starchart img { display: block; margin: 0 auto; }

//
// Tagline
//
Expand Down
6 changes: 5 additions & 1 deletion assets/javascript/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function setDarkMode(dark) {
.attr('src', q + 'btn-' + (dark ? 'day' : 'night') + '.svg')
.css('visibility', 'visible');
$('#discord-frame').attr('src', `${discord_widget_url}&theme=` + (dark ? 'dark' : 'light'));
$('#starchart img').attr('src', 'https://api.star-history.com/svg?repos=MarlinFirmware/Marlin&type=Date' + (dark ? '&theme=dark' : ''));
}

function toggleDarkMode() {
Expand All @@ -60,8 +61,11 @@ function userToggleDarkMode() {
// Set dark / light theme as soon as possible
var nightMode = getCookie('nightMode'); // A cookie?
if (nightMode === '') {
const hasMatchMedia = () => window && window.matchMedia,
prefersDarkColorScheme = () => hasMatchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches,
prefersLightColorScheme = () => hasMatchMedia && window.matchMedia('(prefers-color-scheme: light)').matches;
var d = new Date(), h = d.getHours();
nightMode = (h >= 19 || h < 6);
nightMode = prefersDarkColorScheme || (!prefersLightColorScheme && (h >= 19 || h < 6));
}
else
nightMode = (nightMode === 'true');
Expand Down
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ <h2 id="tagline">Open Source 3D Printer Driver</h2>
</div>
</a>
</div>

<a id="starchart" href="https://star-history.com/#MarlinFirmware/Marlin&Date">
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=MarlinFirmware/Marlin&type=Date" />
</a>

</div>

<script src="{{ '/assets/javascript/vivus.js'}}"></script>
Expand Down

0 comments on commit 8086f48

Please sign in to comment.