diff --git a/src/components/Post/PostTag.vue b/src/components/Post/PostTag.vue
new file mode 100644
index 000000000..c6254626e
--- /dev/null
+++ b/src/components/Post/PostTag.vue
@@ -0,0 +1,28 @@
+
+
+ {{ tag.name }}
+
+
+
diff --git a/src/components/index.js b/src/components/index.js
index 7c4c065d1..8c171da05 100644
--- a/src/components/index.js
+++ b/src/components/index.js
@@ -6,6 +6,7 @@ import FilePondUpload from '@/components/Upload/FilePondUpload'
import AttachmentSelectDrawer from './Attachment/AttachmentSelectDrawer'
import AttachmentUploadModal from './Attachment/AttachmentUploadModal'
import ReactiveButton from './Button/ReactiveButton'
+import PostTag from './Post/PostTag'
const _components = {
Ellipsis,
@@ -13,7 +14,8 @@ const _components = {
FilePondUpload,
AttachmentSelectDrawer,
AttachmentUploadModal,
- ReactiveButton
+ ReactiveButton,
+ PostTag
}
const components = {}
diff --git a/src/utils/colorUtil.js b/src/utils/colorUtil.js
new file mode 100644
index 000000000..260805118
--- /dev/null
+++ b/src/utils/colorUtil.js
@@ -0,0 +1,47 @@
+const isLight = color => {
+ if (!isHex(color)) {
+ return false
+ }
+
+ // Check the format of the color, HEX or RGB?
+ let r, g, b, hsp
+ if (color.match(/^rgb/)) {
+ // If HEX --> store the red, green, blue values in separate variables
+ color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/)
+
+ r = color[1]
+ g = color[2]
+ b = color[3]
+ } else {
+ // If RGB --> Convert it to HEX: http://gist.github.com/983661
+ color = +('0x' + color.slice(1).replace(color.length < 5 && /./g, '$&$&'))
+
+ r = color >> 16
+ g = (color >> 8) & 255
+ b = color & 255
+ }
+
+ // HSP (Highly Sensitive Poo) equation from http://alienryderflex.com/hsp.html
+ hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))
+
+ // Using the HSP value, determine whether the color is light or dark
+ return hsp > 127.5
+}
+
+const randomHex = () => {
+ return '#' + Math.floor(Math.random() * 16777215).toString(16)
+}
+const hexRegExp = /(^#[0-9A-F])/i
+
+const isHex = color => {
+ return hexRegExp.test(color)
+}
+
+const isRgb = color => {
+ return /^rgb/.test(color)
+}
+const isHsl = color => {
+ return /^hsl/.test(color)
+}
+
+export { isLight, randomHex, isHex, hexRegExp, isRgb, isHsl }
diff --git a/src/views/post/PostList.vue b/src/views/post/PostList.vue
index 7aadf3f08..72fb6cb09 100644
--- a/src/views/post/PostList.vue
+++ b/src/views/post/PostList.vue
@@ -201,7 +201,7 @@
{{ tag.name }}
@@ -268,7 +268,7 @@
-
+
{{ tag.name }}
diff --git a/src/views/post/TagList.vue b/src/views/post/TagList.vue
index 325f30de1..a9f075b04 100644
--- a/src/views/post/TagList.vue
+++ b/src/views/post/TagList.vue
@@ -10,6 +10,13 @@
+
+
+
+
+
+
+
@@ -63,9 +70,7 @@
{{ tag.postCount }} 篇文章
- {{ tag.name }}
-
+
@@ -83,9 +88,15 @@