Skip to content

Commit

Permalink
changed accentColor to try and use dark/light vibrant before inverting
Browse files Browse the repository at this point in the history
  • Loading branch information
DerTyp7214 committed Jul 10, 2022
1 parent f73202c commit eb48aab
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "youtube-music",
"productName": "YouTube Music",
"version": "1.18.4",
"version": "1.18.5",
"description": "YouTube Music Desktop App - including custom plugins",
"license": "MIT",
"repository": {
Expand Down
23 changes: 17 additions & 6 deletions plugins/blur-all/front.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const Vibrant = require('node-vibrant/dist/vibrant')
const {ipcRenderer} = require("electron")
const {getAverageRGB} = require("../utils")
const {rgbDiff, DELTAE94_DIFF_STATUS} = require("@vibrant/color/lib/converter")

Expand Down Expand Up @@ -46,17 +45,29 @@ module.exports = () => {
try {
const {r: aR, g: aG, b: aB} = getAverageRGB(image)
const [vR, vG, vB] = palette.Vibrant.rgb
const [dvR, dvG, dvB] = palette.DarkVibrant.rgb
const [lvR, lvG, lvB] = palette.LightVibrant.rgb

const color = rgbToHex([vR, vG, vB])
const colorDark = rgbToHex(palette.DarkVibrant.rgb)
const colorLight = rgbToHex(palette.LightVibrant.rgb)
const averageColor = rgbToHex([aR, aG, aB])

const colorDiff = rgbDiff([aR, aG, aB], [vR, vG, vB])

const similar = colorDiff < DELTAE94_DIFF_STATUS.GOOD

const calculatedColor = similar ? rgbToHex([0xff - vR, 0xff - vG, 0xff - vB]) : rgbToHex([vR, vG, vB])
const colorDiffV = rgbDiff([aR, aG, aB], [vR, vG, vB])
const colorDiffDV = rgbDiff([aR, aG, aB], [dvR, dvG, dvB])
const colorDiffLV = rgbDiff([aR, aG, aB], [lvR, lvG, lvB])

const similarV = colorDiffV < DELTAE94_DIFF_STATUS.GOOD
const similarDV = colorDiffDV < DELTAE94_DIFF_STATUS.GOOD
const similarLV = colorDiffLV < DELTAE94_DIFF_STATUS.GOOD

const calculatedColor = similarV ?
similarDV ?
similarLV ?
rgbToHex([0xff - aR, 0xff - aG, 0xff - aB]) :
rgbToHex([lvR, lvG, lvB]) :
rgbToHex([dvR, dvG, dvB]) :
rgbToHex([vR, vG, vB])

style.textContent = `#progress-bar.ytmusic-player-bar[focused], ytmusic-player-bar:hover #progress-bar.ytmusic-player-bar {
--paper-slider-knob-color: var(--calculated-cover-color);
Expand Down
7 changes: 3 additions & 4 deletions plugins/extract-audio-data/front.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const {ipcRenderer} = require('electron')
const {set} = require("../../config");

const $ = s => document.querySelector(s)

Expand Down Expand Up @@ -30,10 +29,10 @@ const pinkNoise = [
const manipulators = _createCurve(pinkNoise, barCount)

function _createCurve(manipulator, count) {
const times = count / manipulator.length
if (times < 1) return manipulator
const multiplier = count / manipulator.length
if (multiplier < 1) return manipulator
const curve = []
for (let i = 0; i < manipulator.length; i++) for (let j = 0; j < times; j++) curve.push(
for (let i = 0; i < manipulator.length; i++) for (let j = 0; j < multiplier; j++) curve.push(
curve.length > 0 ? (curve[curve.length - 1] + manipulator[i]) / 2 : manipulator[i]
)
return curve
Expand Down
3 changes: 1 addition & 2 deletions plugins/remote/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ module.exports = () => {
width: 1000,
height: 600,
autoHideMenuBar: true,
nodeIntegrationInSubFrames: true,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
}
})

require("@electron/remote/main").enable(window.webContents)

window.loadFile(path.join(__dirname, 'index.html'))
},
},
Expand Down

0 comments on commit eb48aab

Please sign in to comment.