-
Notifications
You must be signed in to change notification settings - Fork 0
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
tkachuk
committed
Feb 3, 2024
1 parent
592462a
commit 2ec004a
Showing
7 changed files
with
160 additions
and
105 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,3 @@ | |
### demo | ||
|
||
[demo](https://imhul.github.io/neumorphine.css) | ||
|
||
### install: | ||
|
||
Coming soon | ||
|
||
### How to use: | ||
|
||
Coming soon |
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
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 |
---|---|---|
@@ -1,33 +1,72 @@ | ||
import { writable } from 'svelte/store'; | ||
import { writable, derived } from 'svelte/store'; | ||
import { getOffsetX, getOffsetY } from '$lib/utils/offset'; | ||
import { | ||
getLightColor, | ||
getDarkColor, | ||
getOppositeColor | ||
} from '$lib/utils/colors'; | ||
|
||
const defaults = { | ||
color: '#ffffff', | ||
export const defaults = { | ||
lightColor: '#ffffff', | ||
darkColor: '#263238', | ||
angle: 45, | ||
offset: 5, | ||
offsetX: '', | ||
offsetY: '', | ||
coeff: 0, | ||
width: 10, | ||
shapeBg: '', | ||
boxShadow: '', | ||
boxShadowInset: '', | ||
shadowWidth: '', | ||
textShadowWidth: '', | ||
gradientFocusedFrom: '', | ||
gradientFocusedTo: '', | ||
showIcons: true | ||
showIcons: true, | ||
mode: true // true for light, false for dark | ||
}; | ||
|
||
export const color = writable(defaults.color); | ||
export const mode = writable(defaults.mode); | ||
export const lightColor = writable(defaults.lightColor); | ||
export const darkColor = writable(defaults.darkColor); | ||
export const color = derived( | ||
[mode, lightColor, darkColor], | ||
([$mode, $lightColor, $darkColor]) => | ||
$mode ? $lightColor : $darkColor | ||
); | ||
|
||
export const angle = writable(defaults.angle); | ||
|
||
export const offset = writable(defaults.offset); | ||
|
||
export const coeff = writable(defaults.coeff); | ||
|
||
export const width = writable(defaults.width); | ||
|
||
export const showIcons = writable(defaults.showIcons); | ||
|
||
export const cssData = writable(defaults); | ||
export const cssData = derived( | ||
[mode, color, angle, offset, coeff, width, showIcons], | ||
([ | ||
$mode, | ||
$color, | ||
$angle, | ||
$offset, | ||
$coeff, | ||
$width, | ||
$showIcons | ||
]) => { | ||
return { | ||
color: $color, | ||
angle: $angle, | ||
showIcons: $showIcons, | ||
shadowWidth: $width + 'px', | ||
textShadowWidth: ($width / 2).toFixed(1) + 'px', | ||
iconColor: getOppositeColor($color), | ||
offsetX: getOffsetX($angle, $offset) + 'px', | ||
offsetY: getOffsetY($angle, $offset) + 'px', | ||
shapeBg: $mode | ||
? getLightColor($color, 10 + $coeff) | ||
: getDarkColor($color, 10 + $coeff), | ||
boxShadow: $mode | ||
? getLightColor($color, 60 + $coeff) | ||
: getDarkColor($color, 60 + $coeff), | ||
boxShadowInset: $mode | ||
? getLightColor($color, 20 + $coeff) | ||
: getDarkColor($color, 20 + $coeff), | ||
gradientFocusedFrom: $mode | ||
? getLightColor($color, 50 + $coeff) | ||
: getDarkColor($color, 50 + $coeff), | ||
gradientFocusedTo: $mode | ||
? getLightColor($color, 70 + $coeff) | ||
: getDarkColor($color, 70 + $coeff) | ||
}; | ||
} | ||
); |
Oops, something went wrong.