Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions lib/svg/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,11 @@ function renderIsometricLabels(
prevMonthStr = monthStr;
}
});

const labelColorHex = params.labelColor ? `#${params.labelColor}` : color;
let labelColorHex = color;
if (params.labelColor) {
const fallbackHex = color.replace(/^#/, '') || 'ffffff';
labelColorHex = `#${sanitizeHexColor(params.labelColor, fallbackHex)}`;
}

monthLabels.forEach((label) => {
const tx = s(GRID_ORIGIN_X + (label.col - MONTH_LABEL_ROW_OFFSET) * TILE_WIDTH_HALF + 8);
Expand Down Expand Up @@ -809,7 +812,9 @@ export function generateSVG(

const text = `#${sanitizeHexColor(params.text, 'ffffff')}`;

const borderAttr = params.border ? `stroke="#${params.border}" stroke-width="2"` : '';
const borderAttr = params.border
? `stroke="#${sanitizeHexColor(params.border, '000000')}" stroke-width="2"`
: '';

const sanitizedFont = sanitizeFont(params.font);
const selectedFont = resolveFont(sanitizedFont);
Expand Down Expand Up @@ -1606,7 +1611,9 @@ export function generateHeatmapSVG(
const accent = `#${sanitizeHexColor(rawAccent, '00ffaa')}`;
const text = `#${sanitizeHexColor(params.text, 'ffffff')}`;

const borderAttr = params.border ? `stroke="#${params.border}" stroke-width="2"` : '';
const borderAttr = params.border
? `stroke="#${sanitizeHexColor(params.border, '000000')}" stroke-width="2"`
: '';

const sanitizedFont = sanitizeFont(params.font);
const selectedFont = resolveFont(sanitizedFont);
Expand Down Expand Up @@ -3128,7 +3135,9 @@ export function generateLanguagesSVG(
const accent = `#${sanitizeHexColor(accentStr, '00ffaa')}`;

const text = `#${sanitizeHexColor(params.text, 'ffffff')}`;
const borderAttr = params.border ? `stroke="#${params.border}" stroke-width="2"` : '';
const borderAttr = params.border
? `stroke="#${sanitizeHexColor(params.border, '000000')}" stroke-width="2"`
: '';

const sanitizedFont = sanitizeFont(params.font);
const selectedFont = resolveFont(sanitizedFont);
Expand Down
Loading