Arras.io Rainbow Theme 2024

This script makes your team rainbow, you can change the colors too! It works on all the teams too!!! Fixed bugs.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Arras.io Rainbow Theme 2024
// @version     1.0.4
// @author      theo
// @namespace   Rainbowify your game
// @description This script makes your team rainbow, you can change the colors too! It works on all the teams too!!! Fixed bugs.
// @match       *://arras.io/
// @match       *://arras.cx/
// @run-at document-load
// @grant none
// ==/UserScript==

const SIZE = 150;
const SAME = false;

(async () => {
    while (!window.Arras() || !window.Arras().themeColor || !window.Arras().themeColor.table) {
        await new Promise(r => setTimeout(r, 40));
    }
    const script = document.createElement("script");
    script.src = "https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.3.7/chroma.min.js";
    document.head.append(script);

    script.onload = () => {
        const scale = chroma.scale(["red","orange","yellow","green","blue","purple"]).colors(SIZE);
        const teamColors = [10, 11, 12,15]; // blue, green, red, purple
        let index = 0;

        function updateColors() {
            const colors = window.Arras().themeColor.table;

            for (let color = 0; color < colors.length; color++) {
                if (teamColors.indexOf(color) < 0) continue;

                if (color === 11) {
                    colors[color] = chroma.scale(["green", "yellow"]).colors(SIZE)[index % SIZE];
                } else if (color === 12) {
                    colors[color] = chroma.scale(["red","black"]).colors(SIZE)[index % SIZE];
                                    } else if (color === 15) {
                    colors[color] = chroma.scale(["purple","blue"]).colors(SIZE)[index % SIZE];


                } else {
                    if (!SAME) {
                        colors[color] = scale[(index + (teamColors.indexOf(color) * SIZE / 4)) % SIZE];
                    } else {
                        colors[color] = scale[index % SIZE];
                    }
                }
            }
            index++;
            index = index % SIZE;
        }

        setInterval(updateColors);
    };
})();