feat(StarryNight): add StarryNight theme (#1051)

This commit is contained in:
Brandon Chen 2024-04-18 23:51:50 -04:00 committed by GitHub
parent 4d596125c5
commit 439051a271
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 457 additions and 4 deletions

23
StarryNight/README.md Normal file
View File

@ -0,0 +1,23 @@
# StarryNight
## Screenshots
![Base](images/starrynightbase.png)
## More
### Created by
- https://github.com/b-chen00
### Credits
- Shooting stars created by [Delroy Prithvi](https://codepen.io/delroyprithvi/pen/LYyJROR) with copyright/permission notice:
> Pure CSS Shooting Star Animation Effect Copyright (c) 2021 by Delroy Prithvi (https://codepen.io/delroyprithvi/pen/LYyJROR)
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

30
StarryNight/color.ini Normal file
View File

@ -0,0 +1,30 @@
[base]
star = FFFFFF
star-glow = FFFFFF
shooting-star = FFFFFF
shooting-star-glow = FFFFFF
main = 000000 ; becomes 100% transparent via javascript
main-elevated = 152238
card = 152238
sidebar = 142b44 ; bottom part of sky
sidebar-alt = 000000 ; top part of sky
text = FFFFFF
subtext = ADB5BD
button-active = FFF3C4
button = FFF3C4
button-disabled = 000000
highlight = 191919
highlight-elevated = FFFFFF
shadow = 000000
selected-row = FFFFFF
misc = 7F7F7F
notification-error = E22134
notification = 4687d6
tab-active = 333333
player = 181818

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

132
StarryNight/theme.js Normal file
View File

@ -0,0 +1,132 @@
function waitForElement(els, func, timeout = 100) {
const queries = els.map(el => document.querySelector(el));
if (queries.every(a => a)) {
func(queries);
} else if (timeout > 0) {
setTimeout(waitForElement, 300, els, func, --timeout);
}
}
function random(min, max) { // min inclusive max exclusive
return Math.random() * (max - min) + min;
}
waitForElement([".Root__top-container"], ([topContainer]) => {
const r = document.documentElement;
const rs = window.getComputedStyle(r);
// make --spice-main transparent for a more visible background
r.style.setProperty('--spice-main', rs.getPropertyValue('--spice-main') + '00');
// to position stars and shooting stars between the background and everything else
const rootElement = document.querySelector('.Root__top-container');
rootElement.style.zIndex = '0';
// create the stars
const canvasSize = topContainer.clientWidth * topContainer.clientHeight;
const starsFraction = canvasSize / 4000;
for (let i = 0; i < starsFraction; i++) {
const size = Math.random() < 0.5 ? 1 : 2;
const star = document.createElement('div');
star.style.position = 'absolute';
star.style.left = random(0, 99) + '%';
star.style.top = random(0, 99) + '%';
star.style.opacity = random(0.5, 1);
star.style.width = size + 'px';
star.style.height = size + 'px';
star.style.backgroundColor = rs.getPropertyValue('--spice-star');
star.style.zIndex = '-1';
if (Math.random() < 1/5) {
star.style.animation = 'twinkle' + (Math.floor(Math.random() * 4) + 1) + ' 5s infinite';
}
topContainer.appendChild(star);
}
// handles resizing of playbar panel to match right sidebar below it
const playbar = document.querySelector('.Root__now-playing-bar');
const rightbar = document.querySelector('.Root__right-sidebar');
const resizeObserver = new ResizeObserver(entries => {
for (let entry of entries) {
if (entry.target === rightbar) {
let newWidth = entry.contentRect.width;
if (newWidth == 0) {
const localStorageWidth = localStorage.getItem('223ni6f2epqcidhx5etjafeai:panel-width-saved') + 'px';
if (localStorageWidth) {
newWidth = localStorageWidth;
}
else {
newWidth = 420;
}
}
playbar.style.width = `${newWidth}px`;
break;
}
}
});
resizeObserver.observe(rightbar);
// start or stop spinning animation based on whether something is playing
const targetElement = document.querySelector('.main-playPauseButton-button');
const playObserver = new MutationObserver(function(mutationsList, observer) {
for (let mutation of mutationsList) {
if (mutation.type === 'attributes' && mutation.attributeName === 'aria-label') {
handleLabelChange();
}
}
});
const playConfig = { attributes: true, attributeFilter: ['aria-label'] };
playObserver.observe(targetElement, playConfig);
function handleLabelChange() {
const img = document.querySelector(".main-nowPlayingWidget-coverArt .cover-art img");
// checks the state of the play button on the playbar
if (document.querySelector('.main-playPauseButton-button').getAttribute('aria-label') == 'Pause'){
img.classList.add('running-animation');
}
else{
img.classList.remove('running-animation');
}
}
/*
Pure CSS Shooting Star Animation Effect Copyright (c) 2021 by Delroy Prithvi (https://codepen.io/delroyprithvi/pen/LYyJROR)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
for (let i = 0; i < 4; i++) {
const shootingstar = document.createElement('span');
shootingstar.className = 'shootingstar';
if (Math.random() < 0.75) {
shootingstar.style.top = '-4px'; // hidden off screen when animation is delayed
shootingstar.style.right = random(0, 90) + '%';
}
else {
shootingstar.style.top = random(0, 50) + '%';
shootingstar.style.right = '-4px'; // hidden when animation is delayed
}
const shootingStarGlowColor = "rgba(" + rs.getPropertyValue('--spice-rgb-shooting-star-glow') + "," + 0.1 + ')';
shootingstar.style.boxShadow = "0 0 0 4px " + shootingStarGlowColor + ", 0 0 0 8px " + shootingStarGlowColor + ", 0 0 20px " + shootingStarGlowColor;
shootingstar.style.animationDuration = Math.floor(Math.random() * (3)) + 3 + 's';
shootingstar.style.animationDelay = Math.floor(Math.random() * 7) + 's';
topContainer.appendChild(shootingstar);
}
});

244
StarryNight/user.css Normal file
View File

@ -0,0 +1,244 @@
.button-module__button___hf2qg_marketplace{
color: var(--spice-subtext)
}
.main-entityHeader-backgroundColor {
background-color: #00000000 !important;
}
.main-actionBarBackground-background {
background-color: #00000000 !important;
}
.main-home-homeHeader {
background-color: #00000000 !important;
}
.Root__top-container {
background: linear-gradient(180deg, var(--spice-sidebar-alt) 0%, var(--spice-sidebar) 100%);
overflow: hidden;
grid-template-areas:
"left-sidebar main-view now-playing-bar"
"left-sidebar main-view right-sidebar";
}
.Root__right-sidebar {
height: calc(100vh - 450px);
width: min-content;
}
.Root__now-playing-bar {
width: var(--panel-width);
}
.main-topBar-background {
background-color: var(--spice-highlight) !important;
}
.Root__nav-bar {
background-color: var(--spice-main) !important;
}
.main-trackList-trackListRow:hover {
background-color: var(--spice-highlight);
}
.main-playPauseButton-button {
background-color: var(--spice-button);
}
.rX_OmqCngvY5ZCoYBZgb {
background-color: var(--background-base) !important;
}
.main-nowPlayingBar-nowPlayingBar {
min-height: 400px;
}
.main-nowPlayingBar-container {
flex-direction: column;
min-width: 280px;
max-width: 420px;
}
.main-nowPlayingBar-nowPlayingBar {
flex-direction: column;
}
[data-right-sidebar-hidden] .Root__main-view {
grid-area: main-view/main-view/main-view/span 1;
}
.main-nowPlayingBar-center {
width: 100%;
}
.main-nowPlayingBar-left {
width: 100%;
}
.HD9s7U5E1RLSWKpXmrqx {
background-color: #00000000;
margin: auto;
width: 100%;
}
.main-nowPlayingWidget-coverArt .cover-art {
height: 220px !important;
width: 220px !important;
margin: auto;
background-color: #00000000;
}
.main-nowPlayingWidget-coverArt .cover-art img {
border-radius: 50%;
animation: spin 25s linear infinite;
animation-play-state: paused;
background-color: #00000000;
box-shadow: 0 0 5px 5px var(--spice-text);
}
.running-animation {
animation-play-state: running !important;
}
.main-coverSlotCollapsed-container {
width: 100%;
height: 100%;
}
.main-coverSlotCollapsed-container > :first-child {
width: 100%;
height: 100%;
}
.main-coverSlotCollapsed-container > :first-child > :first-child {
width: 100%;
height: 100%;
background-color: #00000000;
}
.main-nowPlayingWidget-coverArt {
width: 100%;
height: 100%;
padding-top: 5px;
padding-bottom: 5px;
background-color: #00000000;
}
.main-nowPlayingWidget-nowPlaying {
width: 100%;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
}
.main-coverSlotCollapsed-expandButton {
right: 25%;
}
.player-controls__buttons.player-controls__buttons--new-icons {
order: 2;
}
.playback-bar {
order: 1;
}
.main-nowPlayingBar-right {
width: 100%;
}
.main-nowPlayingBar-extraControls {
justify-content: space-evenly;
}
@keyframes twinkle1 {
0% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
20% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
40% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
60% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
80% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
100% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
}
@keyframes twinkle2 {
0% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
20% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
40% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
60% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
80% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
100% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
}
@keyframes twinkle3 {
0% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
20% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
40% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
60% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
80% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
100% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
}
@keyframes twinkle4 {
0% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
20% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
40% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
60% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
80% { box-shadow: 0px 0px 8px 2px var(--spice-star-glow); }
100% { box-shadow: 0px 0px -8px 2px var(--spice-star-glow); }
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/*
Pure CSS Shooting Star Animation Effect Copyright (c) 2021 by Delroy Prithvi (https://codepen.io/delroyprithvi/pen/LYyJROR)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
.shootingstar {
position: absolute;
width: 4px;
height: 4px;
background: var(--spice-shooting-star);
border-radius: 50%;
animation: animate 3s linear infinite;
left: initial;
z-index: -1;
}
.shootingstar::before {
content:'';
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 300px;
height: 1px;
background: linear-gradient(90deg,var(--spice-shooting-star),transparent);
}
@keyframes animate {
0% {
transform: rotate(315deg) translateX(0);
opacity: 1;
}
70% {
opacity: 1;
}
100% {
transform: rotate(315deg) translateX(-1500px);
opacity: 0;
}
}

View File

@ -160,6 +160,10 @@ Here you can find a preview of all the themes. Some of them may have different c
| ![Eldritch](Sleek/eldritch.png) | |
| Eldritch | |
## StarryNight
![base](StarryNight/images/starrynightbase.png)
## text
### Spotify

View File

@ -221,9 +221,29 @@
{
"name": "Robatortas", "url": "https://github.com/Robatortas"
}
],
"tags": [
"latest"
]
],
"tags": [
"latest"
]
},
{
"name": "StarryNight",
"description": "Starry Night",
"preview": "StarryNight/images/starrynightbase.png",
"readme": "StarryNight/README.md",
"usercss": "StarryNight/user.css",
"schemes": "StarryNight/color.ini",
"include": [
"https://raw.githubusercontent.com/spicetify/spicetify-themes/master/StarryNight/theme.js"
],
"authors": [
{
"name": "Brandon Chen",
"url": "https://github.com/b-chen00"
}
],
"tags": [
"latest"
]
}
]