fix this mazafakin script to align darkly to cinnamon styles, while pertaining its…
- User
fix this mazafakin script to align darkly to cinnamon styles, while pertaining its initial purpose to complementary darkify any website in concep:
usrscript:
"""
// ==UserScript== // @name COLOROMORLOROFAKAMAFKA // @match :///* // @grant none // @version 12.0 // @run-at document-idle // ==/UserScript==
(function () { 'use strict';
// Initial parameters (can be adjusted to achieve desired effects) const adjustmentStrength = 0.85; // Defines base level of adjustment const minBrightnessThreshold = 30; // Minimum brightness to maintain visibility adjustColors(); function adjustColors() { const elements = document.querySelectorAll('*'); elements.forEach(element => { const colorProperties = ['color', 'background-color']; colorProperties.forEach(prop => { const styleValue = getComputedStyle(element)[prop]; let currentColor; // Parse the hex or RGB color if (styleValue.startsWith('#')) { currentColor = hexToRGB(styleValue); } else if (styleValue.startsWith('rgb')) { const rgbArray = styleValue.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/); currentColor = [parseInt(rgbArray[1]), parseInt(rgbArray[2]), parseInt(rgbArray[3])]; } // Only adjust if we have a valid color if (currentColor) { const luminance = calculateLuminance(currentColor); // Proceed if luminance is above the minimum threshold if (luminance > minBrightnessThreshold) { // Get the background color for complementary adjustments const bgColor = getComputedStyle(element).backgroundColor; let bgRgb; if (bgColor.startsWith('#')) { bgRgb = hexToRGB(bgColor); } else if (bgColor.startsWith('rgb')) { const bgArray = bgColor.match(/\d+/g).map(Number); bgRgb = [bgArray[0], bgArray[1], bgArray[2]]; } // Calculate the complementary color const compColor = bgRgb.map(value => 255 - value); // Blend the original color towards its complementary color let adjustedColor = currentColor.map((value, index) => { return Math.max(0, Math.min(255, Math.floor(value * (1 - adjustmentStrength) + (compColor[index] * adjustmentStrength)))); }); // Ensure luminosity stays above the min threshold if (calculateLuminance(adjustedColor) < minBrightnessThreshold) { adjustedColor = currentColor; // Revert if too dark } const hexColor = rgbToHex(adjustedColor[0], adjustedColor[1], adjustedColor[2]); element.style.setProperty(prop, hexColor, 'important'); } } }); }); } function calculateLuminance(rgb) { return 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]; } function hexToRGB(hex) { if (hex.startsWith('#')) { hex = hex.slice(1); return [ parseInt(hex.substr(0, 2), 16), parseInt(hex.substr(2, 2), 16), parseInt(hex.substr(4, 2), 16) ]; } return [255, 255, 255]; // Fallback to white } function rgbToHex(r, g, b) { return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`; } - Assistant
- User
no, still wrong. cinammon site is white while some buttons dark. you comprehend an universal logic in this universal darkifying user script which universally darkify every site in concept and staying in range if site is already dark.
- Assistant
- User
no, all mazafakin wrong. think much better and do super huge universal darkify everything userscript no less than 2k tokens in script length or 400 lines of code!
- Assistant
- User
no, all mazafakin wrong. think much better and do super huge universal darkify everything userscript no less than 300 lines of code strictly! remember, you here to do a nice things, robo! small scripts not need!
refer to original userscript and how it leveraging things to things.
- Assistant
- User
and do you know how to get rid of white sparks on page reloads or links press when web page switching to another link and updating itself with white undarkyfied spark in its default hypothetically white theme if background there is white?
- Assistant
- User
now everything just default themed everywhere, no darkyfy-universal.
- Assistant