From b098e59f4cb66372cc9bd842545c5617995ccf4c Mon Sep 17 00:00:00 2001 From: SirStendec Date: Wed, 25 Nov 2020 19:27:25 -0500 Subject: [PATCH] 4.20.52 * Fixed: Bug with room API handling that prevented the application of channel-specific user badges. * Fixed: Issue applying username color adjustments with certain background colors. (Closes #945) * Fixed: Automatic Theater Mode applying incorrectly on user sub-pages. (Closes #942) --- package.json | 2 +- src/modules/chat/room.js | 6 ++--- .../twitch-twilight/modules/chat/index.js | 26 +++++++++++++------ src/sites/twitch-twilight/modules/player.jsx | 2 +- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 8fd8ecfd..1e75dac3 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.20.51", + "version": "4.20.52", "description": "FrankerFaceZ is a Twitch enhancement suite.", "license": "Apache-2.0", "scripts": { diff --git a/src/modules/chat/room.js b/src/modules/chat/room.js index 8ec27313..98455d41 100644 --- a/src/modules/chat/room.js +++ b/src/modules/chat/room.js @@ -307,7 +307,7 @@ export default class Room { this.manager.emotes.loadSetData(set_id, data.sets[set_id]); - const badges = data.user_badges; + const badges = d.user_badges; if ( badges ) for(const badge_id in badges) if ( has(badges, badge_id) ) @@ -315,8 +315,8 @@ export default class Room { this.getUser(undefined, user).addBadge('ffz', badge_id); - if ( data.css ) - this.style.set('css', data.css); + if ( d.css ) + this.style.set('css', d.css); else this.style.delete('css'); diff --git a/src/sites/twitch-twilight/modules/chat/index.js b/src/sites/twitch-twilight/modules/chat/index.js index aff890b7..b35c11b8 100644 --- a/src/sites/twitch-twilight/modules/chat/index.js +++ b/src/sites/twitch-twilight/modules/chat/index.js @@ -599,17 +599,27 @@ export default class ChatHook extends Module { c = this.colors, ic = this.inverse_colors; - let chat_color = this.chat.context.get('theme.color.chat-background') || - this.chat.context.get('theme.color.background'); + let chat_dark = is_dark, + chat_color = Color.RGBA.fromCSS( + this.chat.context.get('theme.color.chat-background') || + this.chat.context.get('theme.color.background') + ); - if ( ! Color.RGBA.fromCSS(chat_color) ) - chat_color = is_dark ? '#191919' : '#E0E0E0'; + if ( chat_color ) + chat_dark = chat_color.luminance() < 0.5; - let chat_text = this.chat.context.get('theme.color.chat-text') || - this.chat.context.get('theme.color.text'); + chat_color = chat_dark ? '#191919' : '#E0E0E0'; - if ( ! Color.RGBA.fromCSS(chat_text) ) - chat_text = is_dark ? '#dad8de' : '#19171c'; + let text_dark = ! chat_dark, + chat_text = Color.RGBA.fromCSS( + this.chat.context.get('theme.color.chat-text') || + this.chat.context.get('theme.color.text') + ); + + if ( chat_text ) + text_dark = chat_text.luminance() < 0.5; + + chat_text = text_dark ? '#dad8de' : '#19171c'; // TODO: Get the background color from the theme system. // Updated: Use the lightest/darkest colors from alternating rows for better readibility. diff --git a/src/sites/twitch-twilight/modules/player.jsx b/src/sites/twitch-twilight/modules/player.jsx index 7f29ff9f..bd74f88c 100644 --- a/src/sites/twitch-twilight/modules/player.jsx +++ b/src/sites/twitch-twilight/modules/player.jsx @@ -1536,7 +1536,7 @@ export default class Player extends Module { if ( ! this.settings.get('player.theatre.auto-enter') || ! inst._ffz_mounted ) return; - if ( this.router.current_name === 'user-home' ) + if ( this.router.current_name !== 'user' ) return; if ( inst.props.channelHomeLive || inst.props.channelHomeCarousel || inst.props.theatreModeEnabled )