aboutsummaryrefslogtreecommitdiff
path: root/src/services/user_highlighter
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2018-08-05 05:18:04 +0300
committerHenry Jameson <me@hjkos.com>2018-08-05 05:18:04 +0300
commit6a81aa274533b6af1f2514508f6f9fa3b0795c9f (patch)
treee9d8e40cb5621abd037c0d6351160967f6b37996 /src/services/user_highlighter
parentd886ab752c0cc7f12ec569b5fb8ae760e2b45643 (diff)
added ability to pick the style of highlighting
Diffstat (limited to 'src/services/user_highlighter')
-rw-r--r--src/services/user_highlighter/user_highlighter.js42
1 files changed, 32 insertions, 10 deletions
diff --git a/src/services/user_highlighter/user_highlighter.js b/src/services/user_highlighter/user_highlighter.js
index e10ef3bd..31eba2c8 100644
--- a/src/services/user_highlighter/user_highlighter.js
+++ b/src/services/user_highlighter/user_highlighter.js
@@ -1,18 +1,40 @@
import { hex2rgb } from '../color_convert/color_convert.js'
-const highlightStyle = (color) => {
+const highlightStyle = (prefs) => {
+ if (prefs === undefined) {
+ return
+ }
+ const {color, type} = prefs
+ console.log(arguments)
if (typeof color !== 'string') return
const rgb = hex2rgb(color)
+ const solidColor = `rgb(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)})`
const tintColor = `rgba(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)}, .1)`
const tintColor2 = `rgba(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)}, .2)`
- return {
- backgroundImage: [
- 'repeating-linear-gradient(-45deg,',
- `${tintColor} ,`,
- `${tintColor} 20px,`,
- `${tintColor2} 20px,`,
- `${tintColor2} 40px`
- ].join(' '),
- backgroundPosition: '0 0'
+ if (type === 'striped') {
+ return {
+ backgroundImage: [
+ 'repeating-linear-gradient(-45deg,',
+ `${tintColor} ,`,
+ `${tintColor} 20px,`,
+ `${tintColor2} 20px,`,
+ `${tintColor2} 40px`
+ ].join(' '),
+ backgroundPosition: '0 0'
+ }
+ } else if (type === 'solid') {
+ return {
+ backgroundColor: tintColor2
+ }
+ } else if (type === 'side') {
+ return {
+ backgroundImage: [
+ 'linear-gradient(to right,',
+ `${solidColor} ,`,
+ `${solidColor} 2px,`,
+ `transparent 6px`
+ ].join(' '),
+ backgroundPosition: '0 0'
+ }
}
}