Change sky colors locally (client-side only)
// ==UserScript==
// @name Minefun Sky Color Shift
// @namespace https://greasyfork.org
// @version 1.2
// @description Change sky colors locally (client-side only)
// @match *://*minefun*/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
// ===== STYLE INJECTION =====
const style = document.createElement("style");
style.innerHTML = `
.sky-filter {
filter: hue-rotate(0deg) saturate(2) brightness(1.2) !important;
transition: filter 0.5s linear;
}
#skyBtn {
position: fixed;
top: 100px;
right: 20px;
z-index: 99999;
padding: 10px 14px;
background: #111;
color: white;
border: 1px solid #444;
cursor: pointer;
user-select: none;
font-family: sans-serif;
}
`;
document.head.appendChild(style);
// ===== APPLY TO GAME ROOT =====
function applySky() {
// Minefun thường dùng body hoặc canvas wrapper
document.body.classList.add("sky-filter");
}
function removeSky() {
document.body.classList.remove("sky-filter");
}
// ===== BUTTON =====
const btn = document.createElement("div");
btn.id = "skyBtn";
btn.innerText = "Sky OFF";
document.body.appendChild(btn);
let enabled = false;
let hue = 0;
let interval = null;
const colorsSpeed = 20;
btn.onclick = () => {
enabled = !enabled;
if (enabled) {
btn.innerText = "Sky ON";
applySky();
interval = setInterval(() => {
hue += 15;
if (hue > 360) hue = 0;
document.body.style.filter =
`hue-rotate(${hue}deg) saturate(2) brightness(1.3)`;
}, colorsSpeed);
} else {
btn.innerText = "Sky OFF";
clearInterval(interval);
removeSky();
document.body.style.filter = "none";
}
};
// ===== DRAG BUTTON =====
let drag = false, ox, oy;
btn.addEventListener("mousedown", (e) => {
drag = true;
ox = e.clientX - btn.offsetLeft;
oy = e.clientY - btn.offsetTop;
});
document.addEventListener("mousemove", (e) => {
if (!drag) return;
btn.style.left = (e.clientX - ox) + "px";
btn.style.top = (e.clientY - oy) + "px";
btn.style.right = "auto";
});
document.addEventListener("mouseup", () => drag = false);
})();