cleanup, fixed self-highlighting in notifications, fixed incorrect hex code handling

This commit is contained in:
Henry Jameson 2018-08-05 05:41:37 +03:00
parent 6a81aa2745
commit b04a9d1229
3 changed files with 3 additions and 6 deletions

View File

@ -50,6 +50,7 @@ const Status = {
return highlightStyle(highlight[user.screen_name]) return highlightStyle(highlight[user.screen_name])
}, },
userStyle () { userStyle () {
if (this.noHeading) return
const user = this.retweet ? (this.statusoid.retweeted_status.user) : this.statusoid.user const user = this.retweet ? (this.statusoid.retweeted_status.user) : this.statusoid.user
const highlight = this.$store.state.config.highlight const highlight = this.$store.state.config.highlight
return highlightStyle(highlight[user.screen_name]) return highlightStyle(highlight[user.screen_name])

View File

@ -22,8 +22,6 @@ const config = {
}, },
setHighlight (state, { user, color, type }) { setHighlight (state, { user, color, type }) {
const data = this.state.config.highlight[user] const data = this.state.config.highlight[user]
console.log(user, color, type, data)
if (color || type) { if (color || type) {
set(state.highlight, user, { color: color || data.color, type: type || data.type }) set(state.highlight, user, { color: color || data.color, type: type || data.type })
} else { } else {

View File

@ -1,12 +1,10 @@
import { hex2rgb } from '../color_convert/color_convert.js' import { hex2rgb } from '../color_convert/color_convert.js'
const highlightStyle = (prefs) => { const highlightStyle = (prefs) => {
if (prefs === undefined) { if (prefs === undefined) return
return
}
const {color, type} = prefs const {color, type} = prefs
console.log(arguments)
if (typeof color !== 'string') return if (typeof color !== 'string') return
const rgb = hex2rgb(color) const rgb = hex2rgb(color)
if (rgb == null) return
const solidColor = `rgb(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)})` 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 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)` const tintColor2 = `rgba(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)}, .2)`