From 5eec896615e9987e9264a59958a212e8f6ab52f4 Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Wed, 17 Apr 2019 17:13:49 +0900
Subject: [PATCH] Better avgColor

---
 .../app/common/views/components/drive-file-thumbnail.vue      | 2 +-
 src/client/app/desktop/views/components/drive.file.vue        | 2 +-
 src/services/drive/add-file.ts                                | 4 +---
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/client/app/common/views/components/drive-file-thumbnail.vue b/src/client/app/common/views/components/drive-file-thumbnail.vue
index 1a3ef3719..d6b0092ca 100644
--- a/src/client/app/common/views/components/drive-file-thumbnail.vue
+++ b/src/client/app/common/views/components/drive-file-thumbnail.vue
@@ -121,7 +121,7 @@ export default Vue.extend({
 			if (this.file.properties.avgColor) {
 				anime({
 					targets: this.$refs.thumbnail,
-					backgroundColor: this.file.properties.avgColor.replace('255)', '0)'),
+					backgroundColor: 'transparent', // TODO fade
 					duration: 100,
 					easing: 'linear'
 				});
diff --git a/src/client/app/desktop/views/components/drive.file.vue b/src/client/app/desktop/views/components/drive.file.vue
index 46aae9ad2..efc534ee7 100644
--- a/src/client/app/desktop/views/components/drive.file.vue
+++ b/src/client/app/desktop/views/components/drive.file.vue
@@ -142,7 +142,7 @@ export default Vue.extend({
 			if (this.file.properties.avgColor) {
 				anime({
 					targets: this.$refs.thumbnail,
-					backgroundColor: this.file.properties.avgColor.replace('255)', '0)'),
+					backgroundColor: 'transparent', // TODO fade
 					duration: 100,
 					easing: 'linear'
 				});
diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts
index 9287fa820..2f164a4d9 100644
--- a/src/services/drive/add-file.ts
+++ b/src/services/drive/add-file.ts
@@ -363,9 +363,7 @@ export default async function(
 
 				logger.debug(`average color is calculated: ${r}, ${g}, ${b}`);
 
-				const value = info.isOpaque ? `rgba(${r},${g},${b},0)` : `rgba(${r},${g},${b},255)`;
-
-				properties['avgColor'] = value;
+				properties['avgColor'] = `rgb(${r},${g},${b})`;
 			} catch (e) { }
 		};