From 39442bcafe8bf2e8c1d7029b20011b9908dc6633 Mon Sep 17 00:00:00 2001 From: HarlanLuo Date: Sat, 29 Dec 2018 22:23:48 +0800 Subject: [PATCH] invert icon-x color when tag text color is inverted --- browser/main/Detail/TagSelect.js | 11 +++++++++-- resources/icon/icon-x-light.svg | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 resources/icon/icon-x-light.svg diff --git a/browser/main/Detail/TagSelect.js b/browser/main/Detail/TagSelect.js index 511ecf1a..4b924aa3 100644 --- a/browser/main/Detail/TagSelect.js +++ b/browser/main/Detail/TagSelect.js @@ -186,10 +186,17 @@ class TagSelect extends React.Component { ? (showTagsAlphabetically ? _.sortBy(value) : value).map((tag) => { const wrapperStyle = {} const textStyle = {} + const BLACK = '#333333' + const WHITE = '#f1f1f1' const color = coloredTags[tag] + const invertedColor = color && invertColor(color, { black: BLACK, white: WHITE }) + let iconRemove = '../resources/icon/icon-x.svg' if (color) { wrapperStyle.backgroundColor = color - textStyle.color = invertColor(color, { black: '#222', white: '#f1f1f1' }) + textStyle.color = invertedColor + } + if (invertedColor === WHITE) { + iconRemove = '../resources/icon/icon-x-light.svg' } return ( this.handleTagRemoveButtonClick(tag)} > - + ) diff --git a/resources/icon/icon-x-light.svg b/resources/icon/icon-x-light.svg new file mode 100644 index 00000000..39828f0b --- /dev/null +++ b/resources/icon/icon-x-light.svg @@ -0,0 +1,17 @@ + + + + x + Created with Sketch. + + + + + + + + + + + + \ No newline at end of file