From bcf2855773e85648f22beac2d1aab1e2b16cbb1d Mon Sep 17 00:00:00 2001 From: mrwaccaff <36827870+mrwaccaff@users.noreply.github.com> Date: Mon, 1 Feb 2021 15:23:12 +0100 Subject: [PATCH] Update index.js The essence of this Change is to allow user customize the Color Code to be used in highlighting the text Usage will now be lumin(domNode,highlightColor) lumin.start(5000) the highlight color could be any color of users choice e.g red yellow blue or even color Code --- index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 5deca40..38ba0c5 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ class Highlighter { - constructor(root) { + constructor(root,highlightColor) { this._root = root; this._resolve = null; + this._highlightColor=highlightColor; } _initializeOverlay() { @@ -24,7 +25,7 @@ class Highlighter { const style = node.style; style.textDecoration = 'none'; style.color = 'var(--lumin-color, currentColor)'; - style.background = 'var(--lumin-background-color, yellow)'; + style.background = `var(--lumin-background-color, ${this._highlightColor})`; return node; } @@ -182,4 +183,4 @@ class Highlighter { export default function lumin(node) { return new Highlighter(node); -} \ No newline at end of file +}