MCPcopy
hub / github.com/codebymitch/TitanBot / getColor

Function getColor

src/config/bot.js:515–533  ·  view source on GitHub ↗
(path, fallback = "#99AAB5")

Source from the content-addressed store, hash-verified

513export const BotConfig = botConfig;
514
515export function getColor(path, fallback = "#99AAB5") {
516
517 if (typeof path === "number") return path;
518 if (typeof path === "string" && path.startsWith("#")) {
519
520 return parseInt(path.replace("#", ""), 16);
521 }
522 const result = path
523 .split(".")
524 .reduce(
525 (obj, key) => (obj && obj[key] !== undefined ? obj[key] : fallback),
526 botConfig.embeds.colors,
527 );
528
529 if (typeof result === "string" && result.startsWith("#")) {
530 return parseInt(result.replace("#", ""), 16);
531 }
532 return result;
533}
534
535export function getRandomColor() {
536 const colors = Object.values(botConfig.embeds.colors).flatMap((color) =>

Callers 15

executeFunction · 0.90
executeFunction · 0.90
executeFunction · 0.90
handleConfigSubcommandFunction · 0.90
executeFunction · 0.90
handleNameTemplateChangeFunction · 0.90
handleUserLimitChangeFunction · 0.90
handleBitrateChangeFunction · 0.90
handleViewSettingsFunction · 0.90
handleReviewFunction · 0.90
buildDashboardEmbedFunction · 0.90
showApplicationSelectorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected