darkmode
This commit is contained in:
20
src/misc.js
20
src/misc.js
@@ -4,6 +4,7 @@ import {token} from "@/blockchain/token.js";
|
||||
import Color from "color";
|
||||
import {DateTime} from "luxon";
|
||||
import router from "@/router/index.js";
|
||||
import {dateString} from "@/common.js";
|
||||
|
||||
export function nav(name) {
|
||||
// noinspection JSIgnoredPromiseFromCall
|
||||
@@ -101,18 +102,6 @@ export function timestampString(seconds) {
|
||||
}
|
||||
|
||||
|
||||
export function dateString(datetime) {
|
||||
return datetime.toLocaleString({dateStyle: 'medium', timeStyle: 'short'})
|
||||
}
|
||||
|
||||
|
||||
export function timestamp(date = null) {
|
||||
if (date === null)
|
||||
date = new Date()
|
||||
return Math.round(date.getTime() / 1000)
|
||||
}
|
||||
|
||||
|
||||
export function pairKey(chainId, tokenA, tokenB) {
|
||||
const token0 = tokenA.a < tokenB.a ? tokenA.a : tokenB.a
|
||||
const token1 = tokenA.a > tokenB.a ? tokenA.a : tokenB.a
|
||||
@@ -172,7 +161,12 @@ export function uuid() {
|
||||
}
|
||||
|
||||
export function lightenColor(color, lightness = 85, alpha = null) {
|
||||
let c = new Color(color).hsl().lightness(lightness).rgb()
|
||||
let c = new Color(color).hsl()
|
||||
if (useStore().theme === 'light')
|
||||
c = c.lightness(lightness)
|
||||
else
|
||||
c = c.lightness(100-lightness)
|
||||
c = c.rgb()
|
||||
if (alpha !== null)
|
||||
c = c.alpha(alpha)
|
||||
return c.string()
|
||||
|
||||
Reference in New Issue
Block a user