Re: [LyX/master] Change preedit color settings

Koji Yokota <[email protected]> Thu, 16 Jul 2026 23:13:01 +0900
Newsgroups gmane.editors.lyx.devel
Message-ID <[email protected]>
--===============7282618617546376905==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_0DFEFB75-F3E0-4536-8B36-298C74F2DFB1"


--Apple-Mail=_0DFEFB75-F3E0-4536-8B36-298C74F2DFB1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8



> 2026/07/15 20:47=E3=80=81J=C3=BCrgen Spitzm=C3=BCller =
<[email protected]>=E3=81=AE=E3=83=A1=E3=83=BC=E3=83=AB:
>=20
> Am Donnerstag, dem 09.07.2026 um 17:07 +0200 schrieb J=C3=BCrgen
> Spitzm=C3=BCller:
>> Am Mittwoch, dem 08.07.2026 um 10:06 +0900 schrieb Koji Yokota:
>>> I noticed the preview of equations have the same background as the
>>> main text, so in colored insets like LyX Comment, they are shown as
>>> if in another colored box. Can this be fixed e.g. using the
>>> transparency package or else?
>>=20
>> It would need to be fixed in the preview loader which sets the
>> background and foreground color of previews to Color_background and
>> Color_foreground, respectively. You would need to use the inset
>> background color instead, and with transparency, overlay that with
>> Color_background.
>=20
> On a closer look, this small change will cause dvipng to generate
> previews with transparent background:
>=20
> diff --git a/lib/scripts/lyxpreview2bitmap.py
> b/lib/scripts/lyxpreview2bitmap.py
> index 56314356d1..1542af1663 100755
> --- a/lib/scripts/lyxpreview2bitmap.py
> +++ b/lib/scripts/lyxpreview2bitmap.py
> @@ -393,7 +393,7 @@ def main(argv):
>     bg_color =3D bytes(bg_color, 'ascii')
>=20
>     fg_color_dvipng =3D make_texcolor(fg_color, False).decode('ascii')
> -    bg_color_dvipng =3D make_texcolor(bg_color, =
False).decode('ascii')
> +    bg_color_dvipng =3D "Transparent"
>=20
>     # External programs used by the script.
>     latex =3D find_exe_or_terminate(latex or latex_commands)
>=20
> pdftocairo (the PDF chain) does (should) already produce transparent
> background.
>=20
>=20
> However, the previews are still displayed with the workarea =
background.
> If the generated pngs are inserted via inset graphics, on the other
> hand, the background is correctly transparent.
>=20
> So there seems to be some transparency support missing in the
> PreviewLoader chain, as opposed to InsetGraphics.

Many thanks, J=C3=BCrgen!

The attached is a tentative patch that creates png=E2=80=99s with =
transparent background for preview. But preview still picks up the =
workarea background even though png=E2=80=99s background is transparent.

This solid background color cannot be changed from the preferences =
dialog.

Workarea color may be hardcoded to lower layer of the preview image =
somewhere.

Koji


diff --git a/lib/scripts/legacy_lyxpreview2ppm.py =
b/lib/scripts/legacy_lyxpreview2ppm.py
index 6be99d360e..eceead324d 100644
--- a/lib/scripts/legacy_lyxpreview2ppm.py
+++ b/lib/scripts/legacy_lyxpreview2ppm.py
@@ -234,10 +234,8 @@ def legacy_latex_file(latex_file, fg_color, =
bg_color):
                 tmp.write(b"""
 \\usepackage{color}
 \\definecolor{lyxfg}{rgb}{%s}
-\\definecolor{lyxbg}{rgb}{%s}
-\\pagecolor{lyxbg}
 \\usepackage{polyglossia}
-""" % (fg_color_gr, bg_color_gr))
+""" % (fg_color_gr))
                 polyglossia =3D True
                 continue
         success =3D 1
@@ -247,22 +245,20 @@ def legacy_latex_file(latex_file, fg_color, =
bg_color):
             tmp.write(b"""
 \\usepackage{color}
 \\definecolor{lyxfg}{rgb}{%s}
-\\definecolor{lyxbg}{rgb}{%s}
-\\pagecolor{lyxbg}
 \\makeatletter
 \\def\\@tempa{cmr}
 \\ifx\\f@family\\@tempa
   =
\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl=
}}
 \\fi
-""" % (fg_color_gr, bg_color_gr))
+""" % (fg_color_gr))
         tmp.write(b"""
 \\usepackage[%s,tightpage]{preview}
 \\makeatletter
 \\ifdefined\\AddToHook
-  =
\\AddToHook{env/preview/before}{\\leavevmode\\begingroup\\color{lyxbg}\\sp=
ecial{background \\current@color}\\special{ps::clippath fill}}
+  =
\\AddToHook{env/preview/before}{\\leavevmode\\begingroup\\special{ps::clip=
path fill}}
   \\AddToHook{env/preview/after}{\\endgroup}
 \\else
-  =
\\g@addto@macro\\preview{\\leavevmode\\begingroup\\color{lyxbg}\\special{b=
ackground \\current@color}\\special{ps::clippath fill}}
+  =
\\g@addto@macro\\preview{\\leavevmode\\begingroup\\special{ps::clippath =
fill}}
   \\g@addto@macro\\endpreview{\\endgroup}
 \\fi
 \\g@addto@macro\\preview{\\color{lyxfg}}
diff --git a/lib/scripts/lyxpreview2bitmap.py =
b/lib/scripts/lyxpreview2bitmap.py
index 56314356d1..1542af1663 100755
--- a/lib/scripts/lyxpreview2bitmap.py
+++ b/lib/scripts/lyxpreview2bitmap.py
@@ -393,7 +393,7 @@ def main(argv):
     bg_color =3D bytes(bg_color, 'ascii')
=20
     fg_color_dvipng =3D make_texcolor(fg_color, False).decode('ascii')
-    bg_color_dvipng =3D make_texcolor(bg_color, False).decode('ascii')
+    bg_color_dvipng =3D "Transparent"
=20
     # External programs used by the script.
     latex =3D find_exe_or_terminate(latex or latex_commands)


=EF=BF=BC=

--Apple-Mail=_0DFEFB75-F3E0-4536-8B36-298C74F2DFB1
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_D7938F61-D39C-465E-8D94-AA9552AF21EC"


--Apple-Mail=_D7938F61-D39C-465E-8D94-AA9552AF21EC
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html aria-label=3D"message body"><head><meta http-equiv=3D"content-type" =
content=3D"text/html; charset=3Dutf-8"></head><body =
style=3D"overflow-wrap: break-word; -webkit-nbsp-mode: space; =
line-break: after-white-space;"><br id=3D"lineBreakAtBeginningOfMessage">
<div><br><blockquote type=3D"cite"><div>2026/07/15 20:47=E3=80=81J=C3=BCrg=
en Spitzm=C3=BCller &lt;[email protected]&gt;=E3=81=AE=E3=83=A1=E3=83=BC=E3=
=83=AB:</div><br class=3D"Apple-interchange-newline"><div><meta =
charset=3D"UTF-8"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">Am =
Donnerstag, dem 09.07.2026 um 17:07 +0200 schrieb J=C3=BCrgen</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline =
!important;">Spitzm=C3=BCller:</span><br style=3D"caret-color: rgb(0, 0, =
0); font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: =
solid;"><blockquote type=3D"cite" style=3D"font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: solid;">Am =
Mittwoch, dem 08.07.2026 um 10:06 +0900 schrieb Koji =
Yokota:<br><blockquote type=3D"cite">I noticed the preview of equations =
have the same background as the<br>main text, so in colored insets like =
LyX Comment, they are shown as<br>if in another colored box. Can this be =
fixed e.g. using the<br>transparency package or =
else?<br></blockquote><br>It would need to be fixed in the preview =
loader which sets the<br>background and foreground color of previews to =
Color_background and<br>Color_foreground, respectively. You would need =
to use the inset<br>background color instead, and with transparency, =
overlay that with<br>Color_background.<br></blockquote><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">On a =
closer look, this small change will cause dvipng to generate</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline =
!important;">previews with transparent background:</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration-line: none; text-decoration-thickness: auto; =
text-decoration-style: solid;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;">diff --git =
a/lib/scripts/lyxpreview2bitmap.py</span><br style=3D"caret-color: =
rgb(0, 0, 0); font-family: HiraginoSans-W1; font-size: 14px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: solid;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline =
!important;">b/lib/scripts/lyxpreview2bitmap.py</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">index =
56314356d1..1542af1663 100755</span><br style=3D"caret-color: rgb(0, 0, =
0); font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: solid;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">--- =
a/lib/scripts/lyxpreview2bitmap.py</span><br style=3D"caret-color: =
rgb(0, 0, 0); font-family: HiraginoSans-W1; font-size: 14px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: solid;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">+++ =
b/lib/scripts/lyxpreview2bitmap.py</span><br style=3D"caret-color: =
rgb(0, 0, 0); font-family: HiraginoSans-W1; font-size: 14px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: solid;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">@@ -393,7 +393,7 @@ def =
main(argv):</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration-line: none; text-decoration-thickness: auto; =
text-decoration-style: solid;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;">&nbsp;&nbsp;&nbsp;&nbsp;bg_color =3D =
bytes(bg_color, 'ascii')</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: solid;"><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline =
!important;">&nbsp;&nbsp;&nbsp;&nbsp;fg_color_dvipng =3D =
make_texcolor(fg_color, False).decode('ascii')</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">- =
&nbsp;&nbsp;&nbsp;bg_color_dvipng =3D make_texcolor(bg_color, =
False).decode('ascii')</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: solid;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">+ =
&nbsp;&nbsp;&nbsp;bg_color_dvipng =3D "Transparent"</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration-line: none; text-decoration-thickness: auto; =
text-decoration-style: solid;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;">&nbsp;&nbsp;&nbsp;&nbsp;# External programs =
used by the script.</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: solid;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline =
!important;">&nbsp;&nbsp;&nbsp;&nbsp;latex =3D =
find_exe_or_terminate(latex or latex_commands)</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration-line: none; text-decoration-thickness: auto; =
text-decoration-style: solid;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;">pdftocairo (the PDF chain) does (should) =
already produce transparent</span><br style=3D"caret-color: rgb(0, 0, =
0); font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: solid;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">background.</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration-line: none; text-decoration-thickness: auto; =
text-decoration-style: solid;"><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: HiraginoSans-W1; font-size: 14px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: solid;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">However, the previews =
are still displayed with the workarea background.</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">If the =
generated pngs are inserted via inset graphics, on the other</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">hand, =
the background is correctly transparent.</span><br style=3D"caret-color: =
rgb(0, 0, 0); font-family: HiraginoSans-W1; font-size: 14px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: solid;"><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">So =
there seems to be some transparency support missing in the</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HiraginoSans-W1; =
font-size: 14px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: =
none; text-decoration-thickness: auto; text-decoration-style: =
solid;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HiraginoSans-W1; font-size: 14px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline =
!important;">PreviewLoader chain, as opposed to =
InsetGraphics.</span><br></div></blockquote><br></div>Many =
thanks,&nbsp;J=C3=BCrgen!<div><br></div><div>The attached is a tentative =
patch that creates png=E2=80=99s with transparent background for =
preview. But preview still picks up the workarea background even though =
png=E2=80=99s background is transparent.</div><div><br></div><div>This =
solid background color cannot be changed from the preferences =
dialog.</div><div><br></div><div>Workarea color may be hardcoded to =
lower layer of the preview image =
somewhere.</div><div><br></div><div>Koji</div><div><br></div><div><br></di=
v><div><div>diff --git a/lib/scripts/legacy_lyxpreview2ppm.py =
b/lib/scripts/legacy_lyxpreview2ppm.py</div><div>index =
6be99d360e..eceead324d 100644</div><div>--- =
a/lib/scripts/legacy_lyxpreview2ppm.py</div><div>+++ =
b/lib/scripts/legacy_lyxpreview2ppm.py</div><div>@@ -234,10 +234,8 @@ =
def legacy_latex_file(latex_file, fg_color, bg_color):</div><div>&nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;tmp.write(b"""</div><div>&nbsp;\\usepackage{color}</div><div>&nbsp;\=
\definecolor{lyxfg}{rgb}{%s}</div><div>-\\definecolor{lyxbg}{rgb}{%s}</div=
><div>-\\pagecolor{lyxbg}</div><div>&nbsp;\\usepackage{polyglossia}</div><=
div>-""" % (fg_color_gr, bg_color_gr))</div><div>+""" % =
(fg_color_gr))</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp;polyglossia =3D True</div><div>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;continue</div><div>&nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;success =3D 1</div><div>@@ -247,22 +245,20 @@ =
def legacy_latex_file(latex_file, fg_color, bg_color):</div><div>&nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;tmp.write(b"""</div><div>&nbsp;\\usepackage{color}</div><div>&nbsp;\=
\definecolor{lyxfg}{rgb}{%s}</div><div>-\\definecolor{lyxbg}{rgb}{%s}</div=
><div>-\\pagecolor{lyxbg}</div><div>&nbsp;\\makeatletter</div><div>&nbsp;\=
\def\\@tempa{cmr}</div><div>&nbsp;\\ifx\\f@family\\@tempa</div><div>&nbsp;=
 =
&nbsp;\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,a=
ecompl}}</div><div>&nbsp;\\fi</div><div>-""" % (fg_color_gr, =
bg_color_gr))</div><div>+""" % (fg_color_gr))</div><div>&nbsp; &nbsp; =
&nbsp; &nbsp; =
&nbsp;tmp.write(b"""</div><div>&nbsp;\\usepackage[%s,tightpage]{preview}</=
div><div>&nbsp;\\makeatletter</div><div>&nbsp;\\ifdefined\\AddToHook</div>=
<div>- =
&nbsp;\\AddToHook{env/preview/before}{\\leavevmode\\begingroup\\color{lyxb=
g}\\special{background \\current@color}\\special{ps::clippath =
fill}}</div><div>+ =
&nbsp;\\AddToHook{env/preview/before}{\\leavevmode\\begingroup\\special{ps=
::clippath fill}}</div><div>&nbsp; =
&nbsp;\\AddToHook{env/preview/after}{\\endgroup}</div><div>&nbsp;\\else</d=
iv><div>- =
&nbsp;\\g@addto@macro\\preview{\\leavevmode\\begingroup\\color{lyxbg}\\spe=
cial{background \\current@color}\\special{ps::clippath =
fill}}</div><div>+ =
&nbsp;\\g@addto@macro\\preview{\\leavevmode\\begingroup\\special{ps::clipp=
ath fill}}</div><div>&nbsp; =
&nbsp;\\g@addto@macro\\endpreview{\\endgroup}</div><div>&nbsp;\\fi</div><d=
iv>&nbsp;\\g@addto@macro\\preview{\\color{lyxfg}}</div><div>diff --git =
a/lib/scripts/lyxpreview2bitmap.py =
b/lib/scripts/lyxpreview2bitmap.py</div><div>index =
56314356d1..1542af1663 100755</div><div>--- =
a/lib/scripts/lyxpreview2bitmap.py</div><div>+++ =
b/lib/scripts/lyxpreview2bitmap.py</div><div>@@ -393,7 +393,7 @@ def =
main(argv):</div><div>&nbsp; &nbsp; &nbsp;bg_color =3D bytes(bg_color, =
'ascii')</div><div>&nbsp;</div><div>&nbsp; &nbsp; &nbsp;fg_color_dvipng =
=3D make_texcolor(fg_color, False).decode('ascii')</div><div>- &nbsp; =
&nbsp;bg_color_dvipng =3D make_texcolor(bg_color, =
False).decode('ascii')</div><div>+ &nbsp; &nbsp;bg_color_dvipng =3D =
"Transparent"</div><div>&nbsp;</div><div>&nbsp; &nbsp; &nbsp;# External =
programs used by the script.</div><div>&nbsp; &nbsp; &nbsp;latex =3D =
find_exe_or_terminate(latex or =
latex_commands)</div></div><div><br></div><div><br></div><div></div></body=
></html>=

--Apple-Mail=_D7938F61-D39C-465E-8D94-AA9552AF21EC
Content-Disposition: attachment;
	filename=preview.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="preview.patch"
Content-Transfer-Encoding: 7bit

diff --git a/lib/scripts/legacy_lyxpreview2ppm.py b/lib/scripts/legacy_lyxpreview2ppm.py
index 6be99d360e..eceead324d 100644
--- a/lib/scripts/legacy_lyxpreview2ppm.py
+++ b/lib/scripts/legacy_lyxpreview2ppm.py
@@ -234,10 +234,8 @@ def legacy_latex_file(latex_file, fg_color, bg_color):
                 tmp.write(b"""
 \\usepackage{color}
 \\definecolor{lyxfg}{rgb}{%s}
-\\definecolor{lyxbg}{rgb}{%s}
-\\pagecolor{lyxbg}
 \\usepackage{polyglossia}
-""" % (fg_color_gr, bg_color_gr))
+""" % (fg_color_gr))
                 polyglossia = True
                 continue
         success = 1
@@ -247,22 +245,20 @@ def legacy_latex_file(latex_file, fg_color, bg_color):
             tmp.write(b"""
 \\usepackage{color}
 \\definecolor{lyxfg}{rgb}{%s}
-\\definecolor{lyxbg}{rgb}{%s}
-\\pagecolor{lyxbg}
 \\makeatletter
 \\def\\@tempa{cmr}
 \\ifx\\f@family\\@tempa
   \\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}
 \\fi
-""" % (fg_color_gr, bg_color_gr))
+""" % (fg_color_gr))
         tmp.write(b"""
 \\usepackage[%s,tightpage]{preview}
 \\makeatletter
 \\ifdefined\\AddToHook
-  \\AddToHook{env/preview/before}{\\leavevmode\\begingroup\\color{lyxbg}\\special{background \\current@color}\\special{ps::clippath fill}}
+  \\AddToHook{env/preview/before}{\\leavevmode\\begingroup\\special{ps::clippath fill}}
   \\AddToHook{env/preview/after}{\\endgroup}
 \\else
-  \\g@addto@macro\\preview{\\leavevmode\\begingroup\\color{lyxbg}\\special{background \\current@color}\\special{ps::clippath fill}}
+  \\g@addto@macro\\preview{\\leavevmode\\begingroup\\special{ps::clippath fill}}
   \\g@addto@macro\\endpreview{\\endgroup}
 \\fi
 \\g@addto@macro\\preview{\\color{lyxfg}}
diff --git a/lib/scripts/lyxpreview2bitmap.py b/lib/scripts/lyxpreview2bitmap.py
index 56314356d1..1542af1663 100755
--- a/lib/scripts/lyxpreview2bitmap.py
+++ b/lib/scripts/lyxpreview2bitmap.py
@@ -393,7 +393,7 @@ def main(argv):
     bg_color = bytes(bg_color, 'ascii')
 
     fg_color_dvipng = make_texcolor(fg_color, False).decode('ascii')
-    bg_color_dvipng = make_texcolor(bg_color, False).decode('ascii')
+    bg_color_dvipng = "Transparent"
 
     # External programs used by the script.
     latex = find_exe_or_terminate(latex or latex_commands)

--Apple-Mail=_D7938F61-D39C-465E-8D94-AA9552AF21EC
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
	charset=us-ascii

<html aria-label="message body"><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div></div></body></html>
--Apple-Mail=_D7938F61-D39C-465E-8D94-AA9552AF21EC--

--Apple-Mail=_0DFEFB75-F3E0-4536-8B36-298C74F2DFB1--

--===============7282618617546376905==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel

--===============7282618617546376905==--