in render-markdown-codehighlight/generate-theme.cjs [68:84]
function isDarkTheme(color) {
if (!color.startsWith('#') && !color.startsWith('rgb')) {
const hexColor = convertColorNameToHex(color);
if (hexColor) {
color = hexColor;
} else {
return false;
}
}
const hexColor = normalizeHexColor(color);
const rgb = parseInt(hexColor, 16);
const r = (rgb >> 16) & 0xff;
const g = (rgb >> 8) & 0xff;
const b = (rgb >> 0) & 0xff;
const brightness = (r * 299 + g * 587 + b * 114) / 1000; // Calculate brightness based on RGB values
return brightness < 128; // Dark theme if brightness is below the threshold
}