Skip to content
Snippets Groups Projects
Commit a7e80ab4 authored by Lucie Bader's avatar Lucie Bader
Browse files

Correction bug surlignage

parent 0af13deb
No related branches found
No related tags found
No related merge requests found
...@@ -110,6 +110,20 @@ async function getColorForLexicon(lexiconId) { ...@@ -110,6 +110,20 @@ async function getColorForLexicon(lexiconId) {
return (lexiconColors && lexiconColors[String(lexiconId)]) || "#cccccc"; return (lexiconColors && lexiconColors[String(lexiconId)]) || "#cccccc";
} }
/**
* Convertit une couleur hexadécimale en une couleur RGBA.
* @param {string} hex - La couleur en hexadécimal.
* @param {number} opacity - La transparence (0-1).
* @returns {string} La couleur RGBA.
*/
function hexToRgba(hex, opacity) {
const bigint = parseInt(hex.replace('#', ''), 16);
const r = (bigint >> 16) & 255;
const g = (bigint >> 8) & 255;
const b = bigint & 255;
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
}
// Expose les fonctions globalement // Expose les fonctions globalement
window.updateLexiconColors = updateLexiconColors; window.updateLexiconColors = updateLexiconColors;
window.getColorForLexicon = getColorForLexicon; window.getColorForLexicon = getColorForLexicon;
...@@ -117,3 +131,4 @@ window.convertColor = convertColor; ...@@ -117,3 +131,4 @@ window.convertColor = convertColor;
window.getOrCreateLexiconColor = getOrCreateLexiconColor; window.getOrCreateLexiconColor = getOrCreateLexiconColor;
window.createColorCircle = createColorCircle; window.createColorCircle = createColorCircle;
window.getLexiconsColors = getLexiconsColors; window.getLexiconsColors = getLexiconsColors;
window.hexToRgba = hexToRgba;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment