Bots Home
|
Create an App
Colorful
Author:
flexfelix
Description
Source Code
Launch Bot
Current Users
Created by:
Flexfelix
var colors = []; function to_hex(value){ var str = value.toString(16); if (str.length == 1){ str = '0' + str; } return str; } function html_color(r, g, b){ return '#' + to_hex(r) + to_hex(g) + to_hex(b); } function pick_color(){ var r = Math.random(); var g = Math.random(); var b = Math.random(); var max = Math.max(r, g, b); r = Math.round(128 * Math.pow(r/max, 3.)); g = Math.round(128 * Math.pow(g/max, 3.)); b = Math.round(128 * Math.pow(b/max, 3.)); return html_color(r,g,b); } function get_user_color(user){ if (typeof(colors[user]) == 'undefined'){ set_user_color(user); } return colors[user]; } function set_user_color(user){ colors[user] = pick_color(); } cb.onMessage(function (msg){ var user = msg["user"]; msg["c"] = get_user_color(user); if (msg["m"] == "/color"){ set_user_color(user); msg["c"] = get_user_color(user); msg["X-Spam"] = true; } return msg; });
© Copyright Chaturbate 2011- 2026. All Rights Reserved.