Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed Jan 21, 2025
1 parent e29afeb commit 0196b3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
10 changes: 5 additions & 5 deletions py/LunaTranslator/rendertext/somefunctions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from qtsymbols import *
from myutils.config import globalconfig
from gui.textbrowser import TextType
import random


class dataget:
Expand All @@ -16,14 +17,14 @@ def _randomcolor_1(self, word):
c = QColor(globalconfig["cixingcolor"][word["cixing"]])
except:
pass
return (c.red(), c.green(), c.blue(), globalconfig["showcixing_touming"] / 100)
return (c.red(), c.green(), c.blue())

def _randomcolor(self, word):
color = self._randomcolor_1(word)
if not color:
return None
r, g, b, a = color
return "rgba({}, {}, {}, {})".format(r, g, b, a)
color = (random.randint(0, 255) for _ in range(3))
r, g, b = color
return "rgba({}, {}, {}, {})".format(r, g, b, globalconfig["showcixing_touming"] / 100)

def _getfontinfo(self, texttype: TextType):
if texttype == TextType.Origin:
Expand All @@ -39,4 +40,3 @@ def _getfontinfo(self, texttype: TextType):
def _getfontinfo_kana(self):
fm, fs, bold = self._getfontinfo(TextType.Origin)
return fm, fs * globalconfig["kanarate"], bold

5 changes: 1 addition & 4 deletions py/LunaTranslator/rendertext/webview.html
Original file line number Diff line number Diff line change
Expand Up @@ -341,16 +341,13 @@
eleori.classList.add(uid)
eleori.lineHeight = 'normal'
let style = document.createElement('style')
if (isshow_fenci)
style.innerHTML += `.${uid} {
background-color: ${word.color};
}`
if (isfenciclick) {
eleori.setAttribute('word', JSON.stringify(word))
eleori.addEventListener('click', function (e) {
safe_calllunaclickedword(JSON.parse(this.getAttribute('word')))
})
style.innerHTML += `.${uid} {
background: ${isshow_fenci ? word.color : "rgba(0,0,0,0)"};
z-index: 2000;position: relative;
}
.${uid}:hover {
Expand Down

0 comments on commit 0196b3e

Please sign in to comment.