Themes - Bonk.io

Recolors elements in Bonk.io to customizable colors, and allows toggling your theme with a hotkey

目前为 2021-12-12 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Themes - Bonk.io
  3. // @description Recolors elements in Bonk.io to customizable colors, and allows toggling your theme with a hotkey
  4. // @author Excigma
  5. // @namespace https://greasyfork.org/users/416480
  6. // @license GPL-3.0
  7. // @version 0.1.22
  8. // @match https://bonk.io/*
  9. // @require https://cdnjs.cloudflare.com/ajax/libs/jscolor/2.4.6/jscolor.min.js
  10. // @grant GM_addStyle
  11. // @grant GM_registerMenuCommand
  12. // @grant unsafeWindow
  13. // @run-at document-start
  14. // ==/UserScript==
  15.  
  16. (() => {
  17. const configuration_metadata_map = {
  18. hotkey: {
  19. default_dark: "d",
  20. default_light: "d",
  21. description: "Hotkey used to toggle the theme on and off\n(Ctrl + Alt + <key>) or (Ctrl + Shift + <key>)",
  22. datatype: "char"
  23. },
  24. colored_text: {
  25. default_dark: "#40c99e",
  26. default_light: "#032a71",
  27. description: "Text color of Custom game rooms with friends online in the room, and 'Added by' in picks",
  28. datatype: "color"
  29. },
  30. primary_text: {
  31. default_dark: "#f8fafd",
  32. default_light: "#000000",
  33. description: "Primary text color",
  34. datatype: "color"
  35. },
  36. secondary_text: {
  37. default_dark: "#bebebe",
  38. default_light: "#505050",
  39. description: "Secondary text color\nNote: Some of the texts are lightened by 'brightness_lighter' above\nthis will have no affect on such texts (Eg: Chat usernames)",
  40. datatype: "color"
  41. },
  42. text_selection_color: {
  43. default_dark: "#7c7c7c",
  44. default_light: "#338fff",
  45. description: "Background of text when it is selected",
  46. datatype: "color"
  47. },
  48. text_selection_text: {
  49. default_dark: "#f8fafd",
  50. default_light: "#f8fafd",
  51. description: "Text color when text is selected",
  52. datatype: "color"
  53. },
  54. window_color: {
  55. default_dark: "#2b6351",
  56. default_light: "#009688",
  57. description: "Color of window titles\n(Eg: Custom games, Leave Game, Chat, Level Select, ...)",
  58. datatype: "color"
  59. },
  60. window_text: {
  61. default_dark: "#f8fafd",
  62. default_light: "#ffffff",
  63. description: "Color of text in window titles\n(Eg: Custom games, Leave Game, Chat, Level Select, ...)",
  64. datatype: "color"
  65. },
  66. page_background: {
  67. default_dark: "#111111",
  68. default_light: "#1a2733",
  69. description: "Used for the main page's background",
  70. datatype: "color"
  71. },
  72. primary_background: {
  73. default_dark: "#222222",
  74. default_light: "#e2e2e2",
  75. description: "Used as the main background color of windows\n(Eg: Chat background, Leave lobby background, Login page)",
  76. datatype: "color"
  77. },
  78. secondary_background: {
  79. default_dark: "#333333",
  80. default_light: "#f3f3f3",
  81. description: "Secondary background color for things inside windows\n(Eg: Auto login, Joining room status text, Map Editor inputs, ...)",
  82. datatype: "color"
  83. },
  84. behind_lobby_background: {
  85. default_dark: "#131313",
  86. default_light: "#1a2733",
  87. description: "Color for the Lobby's background\n(Eg: Behind the Lobby and Map Editor)",
  88. datatype: "color"
  89. },
  90. red_text: {
  91. default_dark: "#e14747",
  92. default_light: "#cc3333",
  93. description: "Used for player nerf indicator in the lobby",
  94. datatype: "color"
  95. },
  96. blue_text: {
  97. default_dark: "#179be8",
  98. default_light: "#0955c7",
  99. description: "Used for [Load] when a map is suggested, and Copy link is clicked",
  100. datatype: "color"
  101. },
  102. green_text: {
  103. default_dark: "#17e88b",
  104. default_light: "#155824",
  105. description: "Used for player buff and in chat friend requests",
  106. datatype: "color"
  107. },
  108. purple_text: {
  109. default_dark: "#8f68e8",
  110. default_light: "#6033cc",
  111. description: "Used for output of /curate",
  112. datatype: "color"
  113. },
  114. magenta_text: {
  115. default_dark: "#d23cfb",
  116. default_light: "#800d6e",
  117. description: "Used for when [Load] is clicked, or when you are now the host of the game",
  118. datatype: "color"
  119. },
  120. button_color: {
  121. default_dark: "#4f382f",
  122. default_light: "#795548",
  123. description: "Button/dropdown color",
  124. datatype: "color"
  125. },
  126. button_outline_color: {
  127. default_dark: "#4f382f00",
  128. default_light: "#79554800",
  129. description: "Button/dropdown outline color",
  130. datatype: "color"
  131. },
  132. hover_button_color: {
  133. default_dark: "#3a2a24",
  134. default_light: "#7f5d51",
  135. description: "Button/dropdown hover color",
  136. datatype: "color"
  137. },
  138. active_button_color: {
  139. default_dark: "#362620",
  140. default_light: "#4b252b",
  141. description: "Button/dropdown click color",
  142. datatype: "color"
  143. },
  144. disabled_button_color: {
  145. default_dark: "#444444",
  146. default_light: "#777777",
  147. description: "Button/dropdown disabled color",
  148. datatype: "color"
  149. },
  150. button_text: {
  151. default_dark: "#f8fafd",
  152. default_light: "#ffffff",
  153. description: "Button/dropdown text color",
  154. datatype: "color"
  155. },
  156. // button_radius: {
  157. // default_dark: "2",
  158. // default_light: "2",
  159. // description: "Button/dropdown radius",
  160. // datatype: "radius"
  161. // },
  162. xp_bar_fill: {
  163. default_dark: "#473aaf",
  164. default_light: "#473aaf",
  165. description: "XP bar fill color at the top of your screen whilst in-game",
  166. datatype: "color"
  167. },
  168. bonk_header_color: {
  169. default_dark: "#333333",
  170. default_light: "#000000",
  171. description: "Color of the bonk.io header at the top of the page",
  172. datatype: "color"
  173. },
  174. bonk_header_text: {
  175. default_dark: "#bebebe",
  176. default_light: "#4c474a",
  177. description: "Color of the text in the bonk.io header at the top of the page",
  178. datatype: "color"
  179. },
  180. top_bar_color: {
  181. default_dark: "#333333c7",
  182. default_light: "#273749c7",
  183. description: "Color of the 'top bar'\nMake sure this value is dark, the icon colors are white and can't really be easily changed",
  184. datatype: "color"
  185. },
  186. top_bar_hover_color: {
  187. default_dark: "#222222",
  188. default_light: "#2d435a",
  189. description: "Color of buttons in the 'top bar' when hovered",
  190. datatype: "color"
  191. },
  192. top_bar_active_color: {
  193. default_dark: "#191919",
  194. default_light: "#1e2c3c",
  195. description: "Color of buttons in the 'top bar' when active",
  196. datatype: "color"
  197. },
  198. top_bar_text: {
  199. default_dark: "#bebebe",
  200. default_light: "#bebebe",
  201. description: "Color of text in the 'top bar'",
  202. datatype: "color"
  203. },
  204. football_background: {
  205. default_dark: "#161616",
  206. default_light: "#5a7f64",
  207. description: "Color for the Football gamemode's background\n(Note: Requires restarting the football to apply)\nWarning: Unstable, experimental",
  208. datatype: "color"
  209. },
  210. border_color: {
  211. default_dark: "#333333",
  212. default_light: "#a5acb0",
  213. description: "Color used for subtile borders\n(Eg. Settings border, line separating chat and messages in lobby, and Skin Editor shadows)",
  214. datatype: "color"
  215. },
  216. mini_menu_color: {
  217. default_dark: "#191919",
  218. default_light: "#1e2833",
  219. description: "Used for Tooltips and 'Filter by' in Custom Games",
  220. datatype: "color"
  221. },
  222. mini_menu_text: {
  223. default_dark: "#bebebe",
  224. default_light: "#ffffff",
  225. description: "Used for Tooltips and 'Filter by' in Custom Games",
  226. datatype: "color"
  227. },
  228. scrollbar_background: {
  229. default_dark: "#191919",
  230. default_light: "#dddddd",
  231. description: "Used for the scrollbar's background (Chromium only)",
  232. datatype: "color"
  233. },
  234. scrollbar_thumb: {
  235. default_dark: "#555555",
  236. default_light: "#aaaaaa",
  237. description: "Used for the scrollbar's thumb - which is the thing you drag (Chromium only)",
  238. datatype: "color"
  239. },
  240. list_headers: {
  241. default_dark: "#2b3839",
  242. default_light: "#a8bcc0",
  243. description: "Used for the colors of lists\n(Eg: Friends list and the sections in the Map Editor, ...)",
  244. datatype: "color"
  245. },
  246. table_color: {
  247. default_dark: "#444444",
  248. default_light: "#c1cdd2",
  249. description: "Stripe color for use in tables\n(Eg: Custom games, Friends list, Map Editor, Skin Editor, ...)",
  250. datatype: "color"
  251. },
  252. table_alt_color: {
  253. default_dark: "#333333",
  254. default_light: "#d2dbde",
  255. description: "Alternative stripe color used in tables",
  256. datatype: "color"
  257. },
  258. table_hover_color: {
  259. default_dark: "#222222",
  260. default_light: "#aac5d7",
  261. description: "Color used when a row in a table is hovered",
  262. datatype: "color"
  263. },
  264. table_active_color: {
  265. default_dark: "#111111",
  266. default_light: "#9cc8d6",
  267. description: "Color used when a row in a table is selected",
  268. datatype: "color"
  269. },
  270. brightness_lighter: {
  271. default_dark: "2.5",
  272. default_light: "1",
  273. description: "Used to lighten text that have bad contrast with dark colors\nNote: Change to 1 if making a light theme\n(0.5 = 50%, 1.5 = 150% brightness)",
  274. datatype: "brightness"
  275. },
  276. brightness_darker: {
  277. default_dark: "0.6",
  278. default_light: "1",
  279. description: "Used to darken images that that are too bright\nNote: Change to 1 if making a light theme\n(0.5 = 50%, 1.5 = 150% brightness)",
  280. datatype: "brightness"
  281. }
  282. };
  283.  
  284. const datatype_metadata_map = {
  285. "color": {
  286. value: "value",
  287. attributes: {
  288. type: "text",
  289. "data-jscolor": ""
  290. }
  291. },
  292. "percentage": {
  293. value: "value",
  294. attributes: {
  295. type: "number",
  296. max: 1,
  297. min: 0,
  298. step: 0.01
  299. }
  300. },
  301. "brightness": {
  302. value: "value",
  303. attributes: {
  304. type: "number",
  305. max: 10,
  306. min: 0,
  307. step: 0.05
  308. }
  309. },
  310. "radius": {
  311. value: "value",
  312. attributes: {
  313. type: "number",
  314. max: 60,
  315. min: 0,
  316. step: 1
  317. }
  318. },
  319. "char": {
  320. value: "value",
  321. attributes: {
  322. type: "text" ,
  323. maxLength: 1
  324. }
  325. },
  326. };
  327.  
  328. const default_configuration = {};
  329. for (const [key, value] of Object.entries(configuration_metadata_map))
  330. default_configuration[key] = value.default_dark;
  331.  
  332. // Get the currently applied theme
  333. const get_stored_configuration = () => {
  334. // Get the stored theme, if it doesn't exist, it will be null
  335. let stored_theme = localStorage.getItem("bonk_theme");
  336. try {
  337. stored_theme = JSON.parse(stored_theme);
  338. } catch (er) {
  339. // If the stored theme is somehow corrupted - use blank theme
  340. console.log("[Themes] Failed to load theme from localstorage");
  341. console.log(`[Themes] ${stored_theme}`);
  342. console.error(er);
  343. alert("[Themes] Failed to load theme from localstorage");
  344. stored_theme = {};
  345. }
  346. // Merge the stored theme with the default (if null, it will overwrite)
  347. return {...default_configuration, ...stored_theme};
  348. };
  349.  
  350. // Get the stored theme when the page loads
  351. const configuration = get_stored_configuration();
  352.  
  353. // If running inside maingameframe, inject our injectors
  354. if (unsafeWindow.parent !== unsafeWindow) {
  355. if (!unsafeWindow.bonk_theme) unsafeWindow.bonk_theme = {
  356. on: true,
  357. get_football_background: () => parseInt(getComputedStyle(document.documentElement)
  358. .getPropertyValue("--bonk_theme_football_background").trim().slice(1), 16),
  359. get_hotkey: () => getComputedStyle(document.documentElement)
  360. .getPropertyValue("--bonk_theme_hotkey").trim() || default_configuration.hotkey
  361. };
  362.  
  363. // Injector for football mode, if it doesn't work, ...well football will be bright
  364. if (!unsafeWindow.bonkCodeInjectors) unsafeWindow.bonkCodeInjectors = [];
  365. unsafeWindow.bonkCodeInjectors.push(bonkCode => {
  366. try {
  367. // Default football background color, not used elsewhere (yet?)
  368. const FOOTBALL_BACKGROUND_COLOR = "0x5a7f64";
  369. // Few things why I haven't implemented team colors
  370.  
  371. // first off, like football, you wouldn't be able to toggle the colors on and off without
  372. // either reloading, or exiting to the lobby and going back, this script is very very stable yet,
  373. // I wish to allow a hotkey to completely disable the script live
  374. // secondly, I feel like team colors isn't a vital thing people would want to customize, unlike
  375. // football, as football's background is larger than team colors and might be blinding at night
  376. // thirdly, I wish to modify as little of bonk.io's code as possible
  377.  
  378. // eslint-disable-next-line no-unused-vars
  379. const TEAM_COLORS = {
  380. RED: "0xf44336",
  381. BLUE: "0x2196f3",
  382. GREEN: "0x4caf50",
  383. YELLOW: "0xffeb3b"
  384. };
  385.  
  386. let newBonkCode = bonkCode;
  387. newBonkCode = newBonkCode
  388. .replace(
  389. FOOTBALL_BACKGROUND_COLOR,
  390. `(window.bonk_theme.on ? window.bonk_theme.get_football_background() : ${FOOTBALL_BACKGROUND_COLOR})`
  391. )
  392. .replace(
  393. FOOTBALL_BACKGROUND_COLOR,
  394. `(window.bonk_theme.on ? window.bonk_theme.get_football_background() : ${FOOTBALL_BACKGROUND_COLOR})`
  395. );
  396. if (bonkCode === newBonkCode) throw "[Themes] Injection failed!";
  397.  
  398. console.log("Themes injector run");
  399. return newBonkCode;
  400. } catch (er) {
  401. // Silently ignore errors, only football's background will be affected
  402. // which is not that big of a deal
  403. console.log("[Themes] Failed to inject");
  404. console.error(er);
  405. return bonkCode;
  406. }
  407. });
  408. }
  409.  
  410. // Add themed-colors class ASAP as soon as body exists
  411. const observer = new MutationObserver((_, observer) => {
  412. // Detect if body element exists
  413. if (document.body) {
  414. document.body.classList.add("themed-colors");
  415. observer.disconnect();
  416. }
  417. });
  418.  
  419. observer.observe(document, { childList: true, subtree: true });
  420.  
  421. // Run when the page is loaded
  422. document.addEventListener("DOMContentLoaded", () => {
  423. document.body.classList.add("themed-colors");
  424. observer.disconnect();
  425.  
  426. // Check if the script is running inside maingameframe or not
  427. if (unsafeWindow.parent === unsafeWindow) {
  428. // Outer bonk.io website
  429. // Hotkey to turn the script on and off
  430. const maingameframe = document.getElementById("maingameframe");
  431. document.addEventListener("keydown", evt => {
  432. if (!evt.ctrlKey || !(evt.altKey || evt.shiftKey) || !maingameframe.contentWindow.bonk_theme) return;
  433. if (evt.key?.toLowerCase() === maingameframe.contentWindow.bonk_theme.get_hotkey()) {
  434. document.body.classList.toggle("themed-colors");
  435. maingameframe.contentDocument.body.classList.toggle("themed-colors");
  436. maingameframe.contentWindow.bonk_theme.on = !maingameframe.contentWindow.bonk_theme.on;
  437. }
  438. });
  439.  
  440. // Flag to check whether the theme container already exists
  441. let theme_container_created = false;
  442. // Create the menu only when someone clicks on the thing in the menu
  443. // Show the theme container when you click the menu command thing
  444. if (!unsafeWindow.bonk_theme) unsafeWindow.bonk_theme = {};
  445. unsafeWindow.bonk_theme.open_editor = () => {
  446. // Creating a new theme_container, don't make new ones after this
  447. if (theme_container_created) return document.getElementById("theme_container").style.display = "block";
  448. theme_container_created = true;
  449.  
  450. // Create the theme menu. This is really ugly but there's like no other way idk.
  451. const theme_container = document.createElement("div");
  452. const theme_container_title = document.createElement("p");
  453. const configuration_container = document.createElement("div");
  454. const configuration_container_label = document.createElement("label");
  455. const configuration_list = document.createElement("div");
  456. const configuration_json = document.createElement("textarea");
  457. const configuration_json_label = document.createElement("label");
  458. const theme_cancel = document.createElement("div");
  459. const theme_save = document.createElement("div");
  460. const theme_reset_dark = document.createElement("div");
  461. const theme_reset_light = document.createElement("div");
  462. // Add the IDs so we can style them with CSS
  463. theme_container_title.id = "theme_container_title";
  464. theme_container.id = "theme_container";
  465. configuration_container_label.id = "configuration_container_label";
  466. configuration_list.id = "configuration_list";
  467. configuration_json.id = "configuration_json";
  468. theme_cancel.id = "theme_cancel";
  469. theme_save.id = "theme_save";
  470. theme_reset_dark.class = "theme_reset";
  471. theme_reset_light.class = "theme_reset";
  472.  
  473. // Add the classes
  474. theme_container_title.classList.add("classicTopBar");
  475. theme_cancel.classList.add("brownButton", "brownButton_classic", "buttonShadow");
  476. theme_save.classList.add("brownButton", "brownButton_classic", "buttonShadow");
  477. theme_reset_dark.classList.add("brownButton", "brownButton_classic", "buttonShadow");
  478. theme_reset_light.classList.add("brownButton", "brownButton_classic", "buttonShadow");
  479.  
  480. // Add text to buttons and titles
  481. theme_container_title.textContent = "Theme Editor";
  482. theme_cancel.textContent = "CANCEL";
  483. theme_save.textContent = "SAVE";
  484. theme_reset_dark.textContent = "RESET THEME TO DARK PRESET";
  485. theme_reset_light.textContent = "RESET THEME TO LIGHT PRESET";
  486. configuration_container_label.textContent = "Hover over settings for more info";
  487. configuration_json_label.textContent = "Share, Backup or Import theme data - Copy or paste themes from/into the textbox below";
  488. configuration_json_label.for = "configuration_json";
  489. configuration_json.value = JSON.stringify(configuration);
  490. theme_container.appendChild(theme_container_title);
  491.  
  492. configuration_list.appendChild(configuration_container_label);
  493. configuration_list.appendChild(document.createElement("br"));
  494.  
  495. // Populate the themes list with the theme that is currently loaded
  496. for (const [key, value] of Object.entries(configuration)) {
  497. // Check if the setting exists
  498. if (!configuration_metadata_map[key]) continue;
  499. const datatype = configuration_metadata_map[key].datatype;
  500. const datatype_metadata = datatype_metadata_map[datatype];
  501. const configuration_container = document.createElement("div");
  502. const configuration_name = document.createElement("p");
  503. const configuration_value = document.createElement("input");
  504. for (const [key, value] of Object.entries(datatype_metadata.attributes))
  505. configuration_value.setAttribute(key, value);
  506.  
  507. configuration_container.classList.add("configuration_container");
  508. configuration_name.classList.add("configuration_name");
  509. configuration_value.classList.add("configuration_value");
  510.  
  511. configuration_container.dataset["configuration_name"] = key;
  512. configuration_container.title = configuration_metadata_map[key].description ?? "No description";
  513. configuration_name.textContent = key.replace(/_/g, " ");
  514.  
  515. configuration_value[datatype_metadata.value] = value;
  516. configuration_value.addEventListener("input", () => {
  517. if (!datatype_metadata.ignore_change) {
  518. // Update the CSS variable on both bonk.io and maingameframe
  519. document.documentElement.style
  520. .setProperty(`--bonk_theme_${key}`, configuration_value.value);
  521. maingameframe.contentDocument.documentElement.style
  522. .setProperty(`--bonk_theme_${key}`, configuration_value.value);
  523. // Store it in the current configuration (so it can be saved later)
  524. configuration[key] = configuration_value[datatype_metadata.value];
  525. }
  526.  
  527. // Update the data at the bottom
  528. configuration_json.value = JSON.stringify(configuration);
  529. });
  530.  
  531. // Add the current config to the list of settings
  532. configuration_container.appendChild(configuration_name);
  533. configuration_container.appendChild(configuration_value);
  534. configuration_list.appendChild(configuration_container);
  535. }
  536.  
  537. // Add the Save and Cancel buttons
  538. configuration_container.appendChild(theme_cancel);
  539. configuration_container.appendChild(theme_save);
  540.  
  541. configuration_list.appendChild(document.createElement("br")); // this
  542. configuration_list.appendChild(configuration_container);
  543. configuration_list.appendChild(document.createElement("br")); // is
  544. configuration_list.appendChild(configuration_json_label);
  545. configuration_list.appendChild(document.createElement("br")); // so
  546. configuration_list.appendChild(configuration_json);
  547. configuration_list.appendChild(document.createElement("br")); // bad
  548. configuration_list.appendChild(theme_reset_dark);
  549. configuration_list.appendChild(theme_reset_light);
  550. theme_container.appendChild(configuration_list);
  551.  
  552. // When save is clicked, try save theme to localstorage
  553. theme_save.addEventListener("click", () => {
  554. try {
  555. localStorage.setItem("bonk_theme", JSON.stringify(configuration));
  556. theme_container.style.display = "none";
  557. } catch (er) {
  558. console.log("[Themes] Failed to save theme to localstorage");
  559. console.log(`[Themes] ${JSON.stringify(configuration)}`);
  560. console.error(er);
  561. alert("Failed to save theme to localstorage");
  562. }
  563. });
  564.  
  565. // Reset the state of configuration from localstorage
  566. theme_cancel.addEventListener("click", () => {
  567. configuration_json.value = JSON.stringify(get_stored_configuration());
  568. configuration_json.dispatchEvent(new CustomEvent("input"));
  569. theme_container.style.display = "none";
  570. });
  571.  
  572. // Get the currently saved theme, and overwrite everything with it
  573. theme_reset_dark.addEventListener("click", () => {
  574. configuration_json.value = JSON.stringify(default_configuration);
  575. configuration_json.dispatchEvent(new CustomEvent("input"));
  576. });
  577.  
  578. theme_reset_light.addEventListener("click", () => {
  579. // Light theme defaults are not calculated by default, so we need to calculate it here now
  580. const default_light_configuration = {};
  581. for (const [key, value] of Object.entries(configuration_metadata_map))
  582. default_light_configuration[key] = value.default_light;
  583.  
  584. configuration_json.value = JSON.stringify(default_light_configuration);
  585. configuration_json.dispatchEvent(new CustomEvent("input"));
  586. });
  587.  
  588. configuration_json.addEventListener("input", () => {
  589. try {
  590. const new_theme = JSON.parse(configuration_json.value);
  591. // Update the configurations
  592. const configuration_list_children = Array.from(configuration_list.children);
  593. for (const configuration_container of configuration_list_children) {
  594. const key = configuration_container.dataset["configuration_name"];
  595. const value = new_theme[key];
  596. if (!value) continue;
  597.  
  598. const configuration_value = configuration_container.querySelector("input");
  599. const datatype_meta = datatype_metadata_map[configuration_metadata_map[key].datatype];
  600. configuration_value[datatype_meta.value] = value;
  601. configuration_value.dispatchEvent(new CustomEvent("input"));
  602. }
  603.  
  604. // If success, remove the border
  605. configuration_json.style.setProperty("border", "none");
  606. } catch (er) {
  607. console.log("[Themes] Failed to load theme from <textarea>");
  608. console.log(`[Themes] ${configuration_json.value}`);
  609. console.error(er);
  610. // If there is an error, set a red border
  611. configuration_json.style.setProperty("border", "3px solid var(--bonk_theme_red)", "important");
  612. }
  613. });
  614.  
  615. // Add the theme dialog to body
  616. document.body.appendChild(theme_container);
  617.  
  618. // eslint-disable-next-line no-undef
  619. JSColor.presets.default = {
  620. width: 250,
  621. height: 250,
  622. padding: 12,
  623. sliderSize: 24,
  624. format: "hexa",
  625. uppercase: false,
  626. mode: "HVS",
  627. position: "left",
  628. alphaChannel: true,
  629. borderRadius: 3,
  630. backgroundColor: "var(--bonk_theme_mini_menu_color)",
  631. controlBorderColor: "var(--bonk_theme_border_color)",
  632. borderColor: "transparent",
  633. previewSize: 24
  634. };
  635. // eslint-disable-next-line no-undef
  636. JSColor.install();
  637. };
  638.  
  639. // eslint-disable-next-line no-undef
  640. GM_registerMenuCommand("Edit theme", unsafeWindow.bonk_theme.open_editor);
  641. } else {
  642. const bonk_theme_button = document.createElement("div");
  643. const pretty_top_bar = document.getElementById("pretty_top_bar");
  644. const button_count = document.querySelectorAll("#pretty_top_bar>.pretty_top_button.niceborderleft").length;
  645.  
  646. bonk_theme_button.id = "pretty_top_bonk_theme";
  647. bonk_theme_button.classList.add("pretty_top_button", "niceborderleft");
  648. pretty_top_bar.appendChild(bonk_theme_button);
  649.  
  650. // eslint-disable-next-line no-undef
  651. GM_addStyle(`
  652. #pretty_top_bonk_theme {
  653. width: 58px;
  654. height: 34px;
  655. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 24 24'%3E%3Cpath d='M18 4V3c0-.6-.5-1-1-1H5a1 1 0 0 0-1 1v4c0 .6.5 1 1 1h12c.6 0 1-.5 1-1V6h1v4H9v11c0 .6.5 1 1 1h2c.6 0 1-.5 1-1v-9h8V4h-3z'/%3E%3C/svg%3E");
  656. background-size: 24px 24px;
  657. background-repeat: no-repeat;
  658. background-position: center;
  659. position: absolute;
  660. right: ${(button_count * 58) + 1}px;
  661. top: 0;
  662. }
  663. `);
  664.  
  665. bonk_theme_button.addEventListener("click", () => {
  666. unsafeWindow.parent.window.bonk_theme.open_editor();
  667. });
  668. // This code is for inside maingameframe
  669. // Hotkey to turn the script on and off
  670. document.addEventListener("keydown", evt => {
  671. if (!evt.ctrlKey || !(evt.altKey || evt.shiftKey) || !unsafeWindow.bonk_theme) return;
  672. if (evt.key?.toLowerCase() === unsafeWindow.bonk_theme.get_hotkey()) {
  673. unsafeWindow.bonk_theme.on = !unsafeWindow.bonk_theme.on;
  674. document.body.classList.toggle("themed-colors");
  675. unsafeWindow.parent.document.body.classList.toggle("themed-colors");
  676. }
  677. });
  678. }
  679. });
  680. // List of default CSS variables
  681. let root_vars = [];
  682. for (const [key, value] of Object.entries(configuration))
  683. root_vars.push(`--bonk_theme_${key}: ${value};`);
  684.  
  685. // eslint-disable-next-line no-undef
  686. GM_addStyle(`
  687. /* CSS Variables, so we can edit their values on the fly */
  688. :root {
  689. ${root_vars.join("\n ")}
  690. }
  691.  
  692. /* Page background color */
  693. .themed-colors #pagecontainer,
  694. body.themed-colors {
  695. background-color: var(--bonk_theme_page_background) !important;
  696. }
  697.  
  698. :root .themed-colors {
  699. --kkleeMultiSelectColour: var(--bonk_theme_colored_text) !important;
  700. --kkleeErrorColour: var(--bonk_theme_red_text) !important;
  701. --kkleeCheckboxTfsTrue: var(--bonk_theme_green_text) !important;
  702. --kkleeCheckboxTfsFalse: var(--bonk_theme_red_text) !important;
  703. --kkleePreviewSliderDefaultMarkerColour: var(--bonk_theme_button_color) !important;
  704. --kkleePreviewSliderMarkerBackground: linear-gradient(90deg, transparent 36%, var(--kkleePreviewSliderDefaultMarkerColour), transparent 42%) !important;
  705. }
  706.  
  707. /* Dark scroll bar tracks on Firefox and Chromium-based browsers */
  708. .themed-colors {
  709. scrollbar-color: var(--bonk_theme_scrollbar_thumb) var(--bonk_theme_scrollbar_background) !important;
  710. }
  711.  
  712. .themed-colors ::-webkit-scrollbar-track {
  713. background-color: var(--bonk_theme_scrollbar_background) !important;
  714. }
  715.  
  716. .themed-colors ::-webkit-scrollbar-thumb {
  717. background-color: var(--bonk_theme_scrollbar_thumb) !important;
  718. }
  719.  
  720. /* Blockly Scrollbar theming support (for gmmaker by SneezingCactus) */
  721. /* .themed-colors .blocklyScrollbarBackground {
  722. fill: var(--bonk_theme_scrollbar_background) !important;
  723. }
  724.  
  725. .themed-colors .blocklyScrollbarHandle {
  726. fill: var(--bonk_theme_scrollbar_thumb) !important;
  727. } */
  728.  
  729. /* Text selection color */
  730. .themed-colors ::selection {
  731. color: var(--bonk_theme_text_selection_text) !important;
  732. background: var(--bonk_theme_text_selection_color) !important;
  733. }
  734.  
  735. /* Color tooltips */
  736.  
  737. /*
  738. .themed-colors .blocklyDropDownDiv,
  739. .themed-colors .blocklyMenuItem
  740. */
  741. .themed-colors #friendsToolTip,
  742. .themed-colors #pretty_top_replay_report_tooltip,
  743. .themed-colors #pretty_top_replay_fav_tooltip,
  744. .themed-colors #newbonklobby_tooltip,
  745. .themed-colors #mapeditor_rightbox_shapeaddmenucontainer,
  746. .themed-colors #mapeditor_leftbox_createmenucontainerleft,
  747. .themed-colors #mapeditor_leftbox_createmenucontainerright,
  748. .themed-colors #mapeditor_leftbox_copywindow,
  749. .themed-colors #mapeditor_rightbox_newjointmenu,
  750. .themed-colors .newbonklobby_playerentry_menu,
  751. .themed-colors .newbonklobby_playerentry_menu_submenu {
  752. background-color: var(--bonk_theme_mini_menu_color) !important;
  753. color: var(--bonk_theme_mini_menu_text) !important;
  754. }
  755.  
  756. /* Color the lobby's background */
  757. .themed-colors .bt-behind-lobby-background,
  758. .themed-colors #bonkiocontainer {
  759. background-color: var(--bonk_theme_behind_lobby_background) !important;
  760. }
  761. /* Dialogs - I can just do windowShadow, but it might break things if new things are added */
  762. /* It's better to have a new thing visibly light rather than broken */
  763. .themed-colors .bt-primary-background,
  764. .themed-colors #autoLoginContainer,
  765. .themed-colors #guestOrAccountContainer_accountBox,
  766. .themed-colors #guestOrAccountContainer_guestBox,
  767. .themed-colors #guestContainer,
  768. .themed-colors .accountContainer,
  769. .themed-colors #registerwindow_remember_label,
  770. .themed-colors #loginwindow_remember_label,
  771. .themed-colors #loginwindow,
  772. .themed-colors #registerwindow,
  773. .themed-colors #settingsContainer,
  774. .themed-colors .settingsHeading,
  775. .themed-colors .redefineControls_selectionCell:hover,
  776. .themed-colors #newswindow,
  777. .themed-colors #skinmanager,
  778. .themed-colors .skineditor_shapewindow,
  779. .themed-colors .skineditor_shapewindow_imagecontainer,
  780. .themed-colors #skineditor_propertiesbox,
  781. .themed-colors #skineditor_propertiesbox_table,
  782. .themed-colors #skineditor_previewbox,
  783. .themed-colors #skineditor_layerbox,
  784. .themed-colors #skineditor_layerbox_baselabel,
  785. .themed-colors #quickPlayWindow,
  786. .themed-colors #roomlistcreatewindow,
  787. .themed-colors .roomlistcreatewindowlabel,
  788. .themed-colors #roomlistjoinpasswordwindow,
  789. .themed-colors #sm_connectingWindow,
  790. .themed-colors #newbonklobby_specbox,
  791. .themed-colors #newbonklobby_playerbox,
  792. .themed-colors #newbonklobby_chatbox,
  793. .themed-colors #newbonklobby_settingsbox,
  794. .themed-colors #newbonklobby_votewindow,
  795. .themed-colors #newbonklobby_votewindow_maptitle,
  796. .themed-colors #newbonklobby_votewindow_mapauthor,
  797. .themed-colors #leaveconfirmwindow,
  798. .themed-colors #leaveconfirmwindow_text2,
  799. .themed-colors #hostleaveconfirmwindow,
  800. .themed-colors #hostleaveconfirmwindow_text2,
  801. .themed-colors #maploadwindow,
  802. .themed-colors #maploadwindowgreybar,
  803. .themed-colors #maploadwindowstatustext,
  804. .themed-colors #mapeditor_leftbox,
  805. .themed-colors #mapeditor_midbox,
  806. .themed-colors #mapeditor_rightbox,
  807. .themed-colors #mapeditor_save_window,
  808. .themed-colors #kkleeRoot,
  809. .themed-colors #skineditor_colorpicker,
  810. .themed-colors #mapeditor_colorpicker,
  811. .themed-colors #friendsSendWindow,
  812. .themed-colors #roomlistfilterwindow,
  813. .themed-colors #ingamecountdown,
  814. .themed-colors #mapeditor_save_overwrite_window,
  815. .themed-colors #gmeditorwindow,
  816. .themed-colors .newbonklobby_elementcontainer,
  817. #theme_container {
  818. background-color: var(--bonk_theme_primary_background) !important;
  819. color: var(--bonk_theme_primary_text) !important;
  820. }
  821. /* Lighter backgrounds for some menus and stuff */
  822. .themed-colors .bt-secondary-background,
  823. .themed-colors .windowTopBar_classic,
  824. .themed-colors #autoLogin_text,
  825. .themed-colors .guestOrAccountContainerLabelBox,
  826. .themed-colors #guest_nametext,
  827. .themed-colors #loginwindow_username,
  828. .themed-colors #loginwindow_password,
  829. .themed-colors #registerwindow_username,
  830. .themed-colors #registerwindow_password,
  831. .themed-colors #guest_skinbox,
  832. .themed-colors #skineditor_propertiesbox_blocker,
  833. .themed-colors #newswindow_white,
  834. .themed-colors .quickPlayWindowModeDiv,
  835. .themed-colors .quickPlayWindowText1,
  836. .themed-colors .quickPlayWindowText2,
  837. .themed-colors .quickPlayWindowText3,
  838. .themed-colors #roomlist,
  839. .themed-colors #roomlisttableheadercontainer,
  840. .themed-colors .roomlistcreatewindowinput,
  841. .themed-colors .whiteInputField,
  842. .themed-colors #sm_connectingWindow_text,
  843. .themed-colors #friendsContainer,
  844. .themed-colors .friends_table,
  845. .themed-colors .skinmanager_icon,
  846. .themed-colors #maploadwindowsearchinput,
  847. .themed-colors .maploadwindowmapdiv,
  848. .themed-colors #mapeditor_midbox_explain,
  849. .themed-colors #mapeditor_rightbox_namefield,
  850. .themed-colors #descriptioninner,
  851. .themed-colors .control_indicator,
  852. .configuration_value,
  853. #configuration_json {
  854. border-color: transparent !important;
  855. background-color: var(--bonk_theme_secondary_background) !important;
  856. color: var(--bonk_theme_primary_text) !important;
  857. }
  858.  
  859. /*
  860. .themed-colors .blocklyToolboxDiv {
  861. background-color: var(--bonk_theme_secondary_background) !important;
  862. color: var(--bonk_theme_primary_text) !important;
  863. }
  864.  
  865. .themed-colors .blocklyMainBackground {
  866. stroke: none !important;
  867. fill: var(--bonk_theme_secondary_background) !important;
  868. }
  869.  
  870. .themed-colors .blocklyFlyoutBackground {
  871. fill: var(--bonk_theme_mini_menu_color) !important;
  872. }
  873. */
  874.  
  875. /* Style checkboxes */
  876. .themed-colors .control_indicator:after {
  877. border-color: var(--bonk_theme_primary_text) !important;
  878. }
  879.  
  880. .themed-colors #descriptioninner {
  881. background-image: none !important;
  882. box-shadow: -1px -1px 0 rgb(0 0 0 / 10%), -3px -3px 0 var(--bonk_theme_border_color), -4px -4px 0 rgb(0 0 0 / 13%), -6px -6px 0 var(--bonk_theme_border_color), -7px -7px 0 rgb(0 0 0 / 15%), -9px -9px 0 var(--bonk_theme_border_color), -10px -10px 0 rgb(0 0 0 / 18%), 4px 4px 5px var(--bonk_theme_border_color)
  883. }
  884. .themed-colors .mapeditor_field,
  885. .themed-colors .skineditor_field,
  886. .themed-colors .mapeditor_rightbox_table_shape_headerfield {
  887. border-color: transparent;
  888. background-color: var(--bonk_theme_secondary_background);
  889. color: var(--bonk_theme_primary_text);
  890. }
  891. /*
  892. .themed-colors .blocklyEditableText>rect {
  893. fill: var(--bonk_theme_secondary_background) !important;
  894. }
  895.  
  896. .themed-colors .blocklyEditableText>text {
  897. fill: var(--bonk_theme_primary_text) !important;
  898. }
  899. */
  900.  
  901. .themed-colors .newbonklobby_playerentry_name,
  902. .themed-colors #newbonklobby_modetext,
  903. .themed-colors #newbonklobby_roundslabel,
  904. .themed-colors .maploadwindowtext,
  905. .themed-colors #roomliststatustext,
  906. .themed-colors #roomlisttable,
  907. .themed-colors .mapeditor_rightbox_table_leftcell,
  908. .themed-colors .mapeditor_rightbox_table_rightcell,
  909. .themed-colors #ingamecountdown_text,
  910. .themed-colors #bonkiobugemail,
  911. .themed-colors .maploadwindowtext_picks {
  912. color: var(--bonk_theme_primary_text) !important;
  913. }
  914.  
  915. .themed-colors .newbonklobby_mapsuggest_high,
  916. .themed-colors .newbonklobby_chat_msg_name {
  917. color: var(--bonk_theme_primary_text);
  918. }
  919.  
  920. .themed-colors .newbonklobby_playerentry_level,
  921. .themed-colors .newbonklobby_playerentry_pingtext,
  922. .themed-colors #newbonklobby_chat_lowerinstruction,
  923. .themed-colors #newbonklobby_chat_lowerline,
  924. .themed-colors .newbonklobby_chat_msg_txt,
  925. .themed-colors #newbonklobby_chat_input,
  926. .themed-colors #newbonklobby_maptext,
  927. .themed-colors #newbonklobby_roundsinput,
  928. .themed-colors #newbonklobby_mapauthortext,
  929. .themed-colors #newbonklobby_votewindow_maptitle_by,
  930. .themed-colors #hostleaveconfirmwindow_text1,
  931. .themed-colors #leaveconfirmwindow_text1,
  932. .themed-colors .maploadwindowtextmode_picks,
  933. .themed-colors .maploadwindowtextmode,
  934. .themed-colors .maploadwindowtextauthor,
  935. .themed-colors .maploadwindowtextauthor_picks,
  936. .themed-colors .roomlisttablejoined {
  937. color: var(--bonk_theme_secondary_text) !important;
  938. }
  939.  
  940. /* Lobby chat */
  941. .themed-colors .newbonklobby_mapsuggest_low {
  942. color: var(--bonk_theme_secondary_text);
  943. }
  944.  
  945. /* Copy link */
  946. .themed-colors #newbonklobby_chat_content span[style="color: rgb(9, 85, 199);"],
  947. .themed-colors .newbonklobby_chat_link {
  948. color: var(--bonk_theme_blue_text) !important;
  949. }
  950.  
  951. /* /help, player join */
  952. .themed-colors .newbonklobby_playerentry_balance_nerf,
  953. .themed-colors #newbonklobby_chat_content span[style="color: rgb(204, 68, 68);"],
  954. .themed-colors #newbonklobby_chat_content span[style="color: rgb(204, 51, 51);"],
  955. .themed-colors #newbonklobby_chat_content span[style="color: rgb(255, 0, 0);"] {
  956. color: var(--bonk_theme_red_text) !important;
  957. }
  958.  
  959. /* Friend requests */
  960. .themed-colors .newbonklobby_playerentry_balance_buff,
  961. .themed-colors #newbonklobby_chat_content span[style="color: rgb(0, 103, 93);"] {
  962. color: var(--bonk_theme_green_text) !important;
  963. }
  964.  
  965. /* /curate */
  966. .themed-colors #newbonklobby_chat_content span[style="color: rgb(96, 51, 204);"] {
  967. color: var(--bonk_theme_purple_text) !important;
  968. }
  969.  
  970. /* "You are now host" */
  971. .themed-colors #newbonklobby_chat_content span[style="color: rgb(122, 25, 154);"],
  972. .themed-colors #newbonklobby_chat_content span[style="color: rgb(128, 13, 110);"] {
  973. color: var(--bonk_theme_magenta_text) !important;
  974. }
  975.  
  976. /* .themed-colors .blocklyMenuItemCheckbox */
  977. .themed-colors .newbonklobby_chat_status:not([style]) {
  978. filter: brightness(var(--bonk_theme_brightness_lighter)) !important;
  979. }
  980.  
  981. .themed-colors #descriptioncontainer,
  982. .themed-colors #gamethumbbox,
  983. .themed-colors #bgreplay {
  984. filter: brightness(var(--bonk_theme_brightness_darker)) !important;
  985. }
  986.  
  987. /* Style sliders */
  988. .themed-colors .compactSlider,
  989. .themed-colors .newbonklobby_playerentry_balancetext {
  990. background-color: transparent !important;
  991. color: var(--bonk_theme_button_text) !important;
  992. }
  993. .themed-colors.compactSlider::-webkit-slider-runnable-track {
  994. background: var(--bonk_theme_secondary_background);
  995. }
  996. .compactSlider::-webkit-slider-thumb {
  997. background: var(--bonk_theme_primary_text);
  998. }
  999.  
  1000. .compactSlider:focus::-webkit-slider-runnable-track {
  1001. background: var(--bonk_theme_secondary_background);
  1002. }
  1003.  
  1004. .compactSlider::-moz-range-track {
  1005. background: var(--bonk_theme_secondary_background);
  1006. }
  1007.  
  1008. .compactSlider::-moz-range-thumb {
  1009. background: var(--bonk_theme_primary_text);
  1010. }
  1011. .compactSlider::-ms-fill-lower {
  1012. background: var(--bonk_theme_secondary_background);
  1013. }
  1014.  
  1015. .compactSlider::-ms-fill-upper {
  1016. background: var(--bonk_theme_secondary_background);
  1017. }
  1018.  
  1019. .compactSlider::-ms-thumb {
  1020. background: var(--bonk_theme_primary_text);
  1021. }
  1022.  
  1023. .compactSlider:focus::-ms-fill-lower {
  1024. background: var(--bonk_theme_secondary_background);
  1025. }
  1026.  
  1027. .compactSlider:focus::-ms-fill-upper {
  1028. background: var(--bonk_theme_secondary_background);
  1029. }
  1030.  
  1031. /* Style buttons & dropdowns */
  1032. .themed-colors .brownButton_classic,
  1033. .themed-colors .dropdown_classic,
  1034. .themed-colors .skineditor_field_button,
  1035. .themed-colors .mapeditor_field_button,
  1036. .themed-colors .skineditor_basiccolorpicker_closebutton,
  1037. #theme_save, #theme_cancel, .theme_reset {
  1038. background-color: var(--bonk_theme_button_color) !important;
  1039. color: var(--bonk_theme_button_text) !important;
  1040. }
  1041.  
  1042. .themed-colors .brownButton_classic,
  1043. .themed-colors .dropdown-title,
  1044. .themed-colors .skineditor_field_button,
  1045. .themed-colors .mapeditor_field_button,
  1046. .themed-colors .skineditor_basiccolorpicker_closebutton,
  1047. #theme_save, #theme_cancel, .theme_reset {
  1048. outline: 2px solid var(--bonk_theme_button_outline_color) !important;
  1049. outline-offset: -1px !important;
  1050. }
  1051.  
  1052. .themed-colors .brownButtonDisabled,
  1053. .themed-colors .brownButton_disabled_classic,
  1054. .themed-colors .dropdown-option-disabled {
  1055. background-color: var(--bonk_theme_disabled_button_color) !important;
  1056. color: var(--bonk_theme_button_text) !important;
  1057. }
  1058.  
  1059. .themed-colors .brownButton_classic:hover,
  1060. .themed-colors .dropdown_classic:hover,
  1061. .themed-colors .skineditor_basiccolorpicker_closebutton:hover,
  1062. #theme_save:hover, #theme_cancel:hover, .theme_reset:hover {
  1063. background-color: var(--bonk_theme_hover_button_color) !important;
  1064. color: var(--bonk_theme_button_text) !important;
  1065. }
  1066.  
  1067. .themed-colors .brownButton_classic:active,
  1068. .themed-colors .dropdown_classic:active,
  1069. .themed-colors .newbonklobby_teamlockbutton_warn,
  1070. .themed-colors .skineditor_basiccolorpicker_closebutton:active,
  1071. #theme_save:active, #theme_cancel:active, .theme_reset:active {
  1072. background-color: var(--bonk_theme_active_button_color) !important;
  1073. color: var(--bonk_theme_button_text) !important;
  1074. }
  1075.  
  1076. /* Remove border in buttons in the Map and Skin editor, and round them */
  1077. .themed-colors .skineditor_field_button,
  1078. .themed-colors .mapeditor_field_button {
  1079. border-radius: 2px !important;
  1080. border-color: transparent !important;
  1081. }
  1082.  
  1083. .themed-colors .dropdown-title {
  1084. border-radius: 2px !important;
  1085. }
  1086.  
  1087. /* Not sure why there is a white background - removed */
  1088. .themed-colors #maploadtypedropdown {
  1089. background: none !important;
  1090. }
  1091.  
  1092. /* Tables in the game - Skin editor, Map Editor and Custom game list */
  1093. .themed-colors #roomlisttable tr:nth-child(odd),
  1094. .themed-colors .friends_table>tbody:nth-child(odd),
  1095. .themed-colors #skineditor_layerbox_layertable tr:nth-child(odd),
  1096. .themed-colors #mapeditor_leftbox_platformtable tr:nth-child(odd),
  1097. .themed-colors #mapeditor_leftbox_spawntable tr:nth-child(odd),
  1098. .themed-colors #redefineControls_table tr:nth-child(odd),
  1099. .themed-colors .roomlistfilterwindow_a,
  1100. .themed-colors #redefineControls_table th {
  1101. background-color: var(--bonk_theme_table_color) !important;
  1102. color: var(--bonk_theme_primary_text) !important;
  1103. }
  1104.  
  1105. .themed-colors #roomlisttable tr:nth-child(even),
  1106. .themed-colors .friends_table tr:nth-child(even),
  1107. .themed-colors #skineditor_layerbox_layertable tr:nth-child(even),
  1108. .themed-colors #mapeditor_leftbox_platformtable tr:nth-child(even),
  1109. .themed-colors #mapeditor_leftbox_spawntable tr:nth-child(even),
  1110. .themed-colors #redefineControls_table tr:nth-child(even),
  1111. .themed-colors #roomlisttableheadercontainer,
  1112. .themed-colors .roomlistfilterwindow_b {
  1113. background-color: var(--bonk_theme_table_alt_color) !important;
  1114. color: var(--bonk_theme_primary_text) !important;
  1115. }
  1116.  
  1117. .themed-colors #roomlisttable tr.FRIENDSPRESENT,
  1118. .themed-colors .maploadwindowtextaddedby_picks {
  1119. color: var(--bonk_theme_colored_text) !important;
  1120. }
  1121.  
  1122. .themed-colors tr.HOVERUNSELECTED:hover td {
  1123. background-color: var(--bonk_theme_table_hover_color) !important;
  1124. }
  1125.  
  1126. .themed-colors tr.HOVERSELECTED td,
  1127. .themed-colors tr.SELECTED td {
  1128. background-color: var(--bonk_theme_table_active_color) !important;
  1129. }
  1130.  
  1131. /* "popup" color, custom room list top bar */
  1132. .themed-colors .bt-titlebar,
  1133. .themed-colors .windowTopBar_classic,
  1134. .themed-colors .classicTopBar,
  1135. .themed-colors .newbonklobby_boxtop,
  1136. .themed-colors .newbonklobby_boxtop_classic,
  1137. .themed-colors .friends_topbar,
  1138. .themed-colors #newbonklobby_votewindow_top,
  1139. .themed-colors #hostleaveconfirmwindow_top,
  1140. .themed-colors #leaveconfirmwindow_top,
  1141. .themed-colors #ingamecountdown_top,
  1142. .themed-colors #roomlisthidepasswordedcheckboxlabel,
  1143. #theme_container_title {
  1144. background-color: var(--bonk_theme_window_color) !important;
  1145. color: var(--bonk_theme_window_text) !important;
  1146. }
  1147.  
  1148. /* Style the bonk.io header */
  1149. .themed-colors #bonkioheader {
  1150. background-color: var(--bonk_theme_bonk_header_color) !important;
  1151. color: var(--bonk_theme_bonk_header_text) !important;
  1152. }
  1153.  
  1154. /* Style the top bar */
  1155. .themed-colors #pretty_top_bar {
  1156. background-color: var(--bonk_theme_top_bar_color) !important;
  1157. color: var(--bonk_theme_top_bar_text) !important;
  1158. }
  1159.  
  1160. .themed-colors .pretty_top_button,
  1161. .themed-colors #pretty_top_name,
  1162. .themed-colors #pretty_top_name,
  1163. .themed-colors #pretty_top_level,
  1164. .themed-colors #pretty_top_playercount {
  1165. color: var(--bonk_theme_top_bar_text) !important;
  1166. }
  1167.  
  1168. .themed-colors #pretty_top_replay>.pretty_top_button,
  1169. .themed-colors #pretty_top_volume>.pretty_top_button {
  1170. background-color: var(--bonk_theme_top_bar_color) !important;
  1171. }
  1172.  
  1173. .themed-colors .pretty_top_button:hover,
  1174. .themed-colors #pretty_top_replay>.pretty_top_button:hover,
  1175. .themed-colors #pretty_top_volume>.pretty_top_button:hover {
  1176. background-color: var(--bonk_theme_top_bar_hover_color) !important;
  1177. }
  1178.  
  1179. .themed-colors .pretty_top_button:active,
  1180. .themed-colors #pretty_top_replay>.pretty_top_button:active,
  1181. .themed-colors #pretty_top_volume>.pretty_top_button:active {
  1182. background-color: var(--bonk_theme_top_bar_active_color) !important;
  1183. }
  1184.  
  1185. /* .themed-colors .blocklyDropDownDiv */
  1186. /* Change color of borders in settings and the map editor */
  1187. .themed-colors .mapeditor_rightbox_table_shape_container,
  1188. .themed-colors #redefineControls_table td,
  1189. .themed-colors #redefineControls_table th,
  1190. .themed-colors #redefineControls_table,
  1191. .themed-colors .descriptionthumbl,
  1192. .themed-colors .descriptionthumbr {
  1193. border: 1px solid var(--bonk_theme_border_color) !important;
  1194. }
  1195.  
  1196. /* Change shadow colors */
  1197. .themed-colors .skinmanager_icon,
  1198. .themed-colors #skineditor_previewbox_skincontainer {
  1199. box-shadow: 2px 2px 3px var(--bonk_theme_border_color) !important;
  1200. }
  1201.  
  1202. /* Players in lobby */
  1203. .themed-colors .newbonklobby_playerentry {
  1204. border-left: 4px solid var(--bonk_theme_primary_background) !important;
  1205. border-top: 4px solid var(--bonk_theme_primary_background) !important;
  1206. border-right: 4px solid var(--bonk_theme_primary_background) !important;
  1207. background-color: var(--bonk_theme_primary_background) !important;
  1208. color: var(--bonk_theme_primary_text) !important;
  1209. }
  1210.  
  1211. .themed-colors .newbonklobby_playerentry:hover {
  1212. border-left: 4px solid var(--bonk_theme_secondary_background) !important;
  1213. border-top: 4px solid var(--bonk_theme_secondary_background) !important;
  1214. border-right: 4px solid var(--bonk_theme_secondary_background) !important;
  1215. background-color: var(--bonk_theme_secondary_background) !important;
  1216. }
  1217.  
  1218. .themed-colors #newbonklobby_chat_lowerline {
  1219. border-top: 1px solid var(--bonk_theme_border_color) !important;
  1220. }
  1221.  
  1222. .themed-colors #newbonklobby_playerbox_middleline {
  1223. border-left: 1px solid var(--bonk_theme_border_color) !important;
  1224. }
  1225.  
  1226. /* Headings in the Map Editor and stuff */
  1227. .themed-colors .friends_titles,
  1228. .themed-colors .mapeditor_table_heading_div {
  1229. background-color: var(--bonk_theme_list_headers) !important;
  1230. }
  1231.  
  1232. /* Change the XP bar to use the colors we want */
  1233. .themed-colors #xpbarfill {
  1234. background-color: var(--bonk_theme_xp_bar_fill) !important;
  1235. }
  1236.  
  1237. /* Below is CSS for our theme editor thing */
  1238. #theme_container {
  1239. border-radius: 3px 0px 3px 3px;
  1240. z-index: 999;
  1241. font-family: "futurept_b1";
  1242. padding: 0px;
  1243. right: 0px;
  1244. top: 0px;
  1245. position: fixed;
  1246. overflow-y: scroll;
  1247. max-height: 100vh;
  1248. width: 20em;
  1249. }
  1250.  
  1251. #configuration_list {
  1252. padding: 1.5em;
  1253. display: flex;
  1254. flex-direction: column;
  1255. }
  1256.  
  1257. #theme_container_title {
  1258. text-align: center;
  1259. margin: 0px;
  1260. font-size: 20px;
  1261. line-height: 32px;
  1262. font-family: "futurept_b1"
  1263. }
  1264.  
  1265. .configuration_container {
  1266. white-space: pre-line;
  1267. display: flex;
  1268. justify-content: space-between;
  1269. align-items: center;
  1270. height: 2.25em;
  1271. }
  1272.  
  1273. .configuration_name {
  1274. text-transform: capitalize;
  1275. float: left;
  1276. width: 70%;
  1277. }
  1278.  
  1279. .configuration_value {
  1280. float: right;
  1281. width: 25%;
  1282. }
  1283.  
  1284. .configuration_value.jscolor {
  1285. border-left: none !important;
  1286. }
  1287.  
  1288. #theme_cancel {
  1289. float: left;
  1290. }
  1291.  
  1292. #theme_save {
  1293. float: right;
  1294. }
  1295.  
  1296. #theme_save,
  1297. #theme_cancel {
  1298. width: 45%;
  1299. height: 30px;
  1300. line-height: 30px;
  1301. }
  1302.  
  1303. #configuration_json {
  1304. align-self: center;
  1305. resize: none;
  1306. width: 100%;
  1307. height: 15em;
  1308. }
  1309. `);
  1310. })();