Skip to content

Commit

Permalink
Clean up variable naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuuuube committed Nov 6, 2024
1 parent 3751752 commit 48fc947
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ext/js/display/display-anki.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ export class DisplayAnki {
*/
_getFlagName(flag) {
/** @type {Record<number, string>} */
const flagNames = {
const flagNamesDict = {
1: 'Red',
2: 'Orange',
3: 'Green',
Expand All @@ -583,8 +583,8 @@ export class DisplayAnki {
6: 'Turquoise',
7: 'Purple',
};
if (flag in flagNames) {
return flagNames[flag];
if (flag in flagNamesDict) {
return flagNamesDict[flag];
}
return '';
}
Expand All @@ -595,7 +595,7 @@ export class DisplayAnki {
*/
_getFlagColor(flags) {
/** @type {Record<string, import('display-anki').RGB>} */
const flagColors = {
const flagColorsDict = {
Red: {red: 248, green: 113, blue: 113},
Orange: {red: 253, green: 186, blue: 116},
Green: {red: 134, green: 239, blue: 172},
Expand All @@ -610,9 +610,9 @@ export class DisplayAnki {

let gradient = 'linear-gradient(to right,';
for (const flag of flags) {
const flagRGB = flagColors[flag];
gradient += 'rgb(' + flagRGB.red + ',' + flagRGB.green + ',' + flagRGB.blue + ') ' + currentGradientPercent + '%,';
gradient += 'rgb(' + flagRGB.red + ',' + flagRGB.green + ',' + flagRGB.blue + ') ' + (currentGradientPercent + gradientSliceSize) + '%,';
const flagColor = flagColorsDict[flag];
gradient += 'rgb(' + flagColor.red + ',' + flagColor.green + ',' + flagColor.blue + ') ' + currentGradientPercent + '%,';
gradient += 'rgb(' + flagColor.red + ',' + flagColor.green + ',' + flagColor.blue + ') ' + (currentGradientPercent + gradientSliceSize) + '%,';
currentGradientPercent += gradientSliceSize;
}
gradient = gradient.slice(0, -1); // remove trailing comma
Expand Down

0 comments on commit 48fc947

Please sign in to comment.