Index: compile_rules.py ================================================================== --- compile_rules.py +++ compile_rules.py @@ -38,15 +38,17 @@ def createColors (dColor): "dictionary of colors {color_name: [h, s, l]} -> returns dictionary of colors as dictionaries of color types" dColorType = { + "aHSL": {}, # dictionary of colors as HSL list "sCSS": {}, # dictionary of colors as strings for HTML/CSS (example: hsl(0, 50%, 50%)) - "aRGB": {}, # dictionary of colors as RGB tuple + "aRGB": {}, # dictionary of colors as RGB list "nInt": {} # dictionary of colors as integer values (for Writer) } for sKey, aHSL in dColor.items(): + dColorType["aHSL"][sKey] = aHSL dColorType["sCSS"][sKey] = "hsl({}, {}%, {}%)".format(*aHSL) dColorType["aRGB"][sKey] = convertHSLToRBG(*aHSL) dColorType["nInt"][sKey] = convertRGBToInteger(*dColorType["aRGB"][sKey]) return dColorType Index: gc_lang/fr/webext/content_scripts/panel_gc.css ================================================================== --- gc_lang/fr/webext/content_scripts/panel_gc.css +++ gc_lang/fr/webext/content_scripts/panel_gc.css @@ -16,11 +16,11 @@ p.grammalecte_paragraph { margin: 0; padding: 12px; background-color: hsl(0, 0%, 96%); border-radius: 2px; - line-height: normal; + line-height: 1.3; text-align: left; font-size: 14px; font-family: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace; color: hsl(0, 0%, 0%); hyphens: none; @@ -207,30 +207,37 @@ /* ERRORS */ -mark.grammalecte_error { +mark.grammalecte_error, +mark.grammalecte_spellerror { margin: 0; padding: 0; cursor: pointer; border-radius: 2px; - /* default color */ - background-color: hsl(240, 10%, 50%); - color: hsl(240, 0%, 96%); + background-color: hsl(240, 0%, 80%); /* default color */ + color: hsl(240, 0%, 10%); /* default color */ + border-bottom: solid 2px hsl(0, 0%, 50%); /* default color */ font-size: 14px; font-style: normal; font-family : "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace; text-decoration: none; text-shadow: unset; text-align: left; hyphens: none; } -mark.grammalecte_error:hover { - background-color: hsl(240, 10%, 40%); - color: hsl(240, 0%, 100%); - box-shadow: 0px 0px 0px 3px hsla(0, 0%, 50%, 0.2); +mark.grammalecte_error:hover, +mark.grammalecte_spellerror:hover { + opacity: .9; + box-shadow: 0px 0px 0px 3px hsla(0, 0%, 50%, 0.25); +} + +mark.grammalecte_spellerror { + background-color: hsl(0, 100%, 88%); + color: hsl(0, 80%, 30%); + border-bottom: solid 2px hsl(0, 100%, 50%); } mark.grammalecte_error_corrected, mark.grammalecte_error_ignored { margin: 0; Index: gc_lang/fr/webext/content_scripts/panel_gc.js ================================================================== --- gc_lang/fr/webext/content_scripts/panel_gc.js +++ gc_lang/fr/webext/content_scripts/panel_gc.js @@ -347,21 +347,32 @@ xNodeErr.id = "grammalecte_err" + oErr['sErrorId']; xNodeErr.textContent = sUnderlined; xNodeErr.dataset.error_id = oErr['sErrorId']; xNodeErr.dataset.ignored_key = oErr['sIgnoredKey']; xNodeErr.dataset.error_type = (oErr['sType'] === "WORD") ? "spelling" : "grammar"; - if (xNodeErr.dataset.error_type === "grammar") { + if (this.aIgnoredErrors.has(xNodeErr.dataset.ignored_key)) { + xNodeErr.className = "grammalecte_error_ignored"; + } + else if (xNodeErr.dataset.error_type === "grammar") { + xNodeErr.className = "grammalecte_error"; xNodeErr.dataset.gc_message = oErr['sMessage']; xNodeErr.dataset.gc_url = oErr['URL']; if (xNodeErr.dataset.gc_message.includes(" #")) { xNodeErr.dataset.line_id = oErr['sLineId']; xNodeErr.dataset.rule_id = oErr['sRuleId']; } xNodeErr.dataset.suggestions = oErr["aSuggestions"].join("|"); + let sHue = oErr["aColor"][0].toString(); + let sSat = oErr["aColor"][1].toString(); + let sLum = oErr["aColor"][2].toString(); + xNodeErr.style.color = `hsl(${sHue}, ${sSat}%, 15%)`; + xNodeErr.style.backgroundColor = `hsl(${sHue}, ${sSat}%, 85%)`; + xNodeErr.style.borderBottom = `solid 2px hsl(${sHue}, ${sSat}%, ${sLum}%)`; } - xNodeErr.className = (this.aIgnoredErrors.has(xNodeErr.dataset.ignored_key)) ? "grammalecte_error_ignored" : "grammalecte_error"; - xNodeErr.style.backgroundColor = (oErr['sType'] === "WORD") ? "hsl(0, 50%, 50%)" : oErr["aColor"]; + else { + xNodeErr.className = "grammalecte_spellerror"; + } return xNodeErr; } _blockParagraph (xParagraph) { xParagraph.contentEditable = "false"; @@ -404,10 +415,11 @@ try { let sErrorId = this.xParent.getElementById(sIgnoreButtonId).dataset.error_id; let xNodeErr = this.xParent.getElementById("grammalecte_err" + sErrorId); this.aIgnoredErrors.add(xNodeErr.dataset.ignored_key); xNodeErr.className = "grammalecte_error_ignored"; + xNodeErr.removeAttribute("style"); this.oTooltip.hide(); } catch (e) { showError(e); } Index: gc_lang/fr/webext/gce_worker.js ================================================================== --- gc_lang/fr/webext/gce_worker.js +++ gc_lang/fr/webext/gce_worker.js @@ -174,11 +174,11 @@ //console.log("[Worker] Loading… Extension path: " + sExtensionPath); conj.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/conj_data.json")); phonet.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/phonet_data.json")); mfsp.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/mfsp_data.json")); //console.log("[Worker] Modules have been initialized…"); - gc_engine.load(sContext, "sCSS", sExtensionPath+"grammalecte/graphspell/_dictionaries"); + gc_engine.load(sContext, "aHSL", sExtensionPath+"grammalecte/graphspell/_dictionaries"); oSpellChecker = gc_engine.getSpellChecker(); oTest = new TestGrammarChecking(gc_engine, sExtensionPath+"/grammalecte/fr/tests_data.json"); oTokenizer = new Tokenizer("fr"); oLocution = helpers.loadFile(sExtensionPath + "/grammalecte/fr/locutions_data.json"); oLxg = new Lexicographe(oSpellChecker, oTokenizer, oLocution);