mirror of
https://github.com/Aviortheking/codestats-readme.git
synced 2025-08-05 02:11:59 +00:00
feat: added hide_langs_below option
This commit is contained in:
@@ -30,15 +30,22 @@ const renderTopLanguages = (topLangs, options = {}) => {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
hide_langs_below,
|
||||
theme,
|
||||
} = options;
|
||||
|
||||
const langs = Object.values(topLangs);
|
||||
let langs = Object.values(topLangs);
|
||||
|
||||
const totalSize = langs.reduce((acc, curr) => {
|
||||
return acc + curr.size;
|
||||
}, 0);
|
||||
|
||||
// hide langs
|
||||
langs = langs.filter((lang) => {
|
||||
if (!hide_langs_below) return true;
|
||||
return (lang.size / totalSize) * 100 > hide_langs_below;
|
||||
});
|
||||
|
||||
// returns theme based colors with proper overrides and defaults
|
||||
const { titleColor, textColor, bgColor } = getCardColors({
|
||||
title_color,
|
||||
|
Reference in New Issue
Block a user