https://bugs.documentfoundation.org/show_bug.cgi?id=153341

            Bug ID: 153341
           Summary: Copied HTML text which uses the alpha channel is
                    pasted either without it (when rgb(r g b / a) notation
                    is used) or without any color (when rgba(r, g, b, a)
                    notation is used)
           Product: LibreOffice
           Version: 7.4.4.2 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]

Description:
Hello,

copying-and-pasting HTML text whose inline style contains color into
LibreOffice Writer does not work properly, as the pasted text will not always
show its actual color.

When the rgb(r g b / a) CSS notation is used, the alpha channel is ignored and
rgb(r, g, b) is used instead.

When the rgba(r, g, b, a) CSS format is used, the color is ignored entirely.

Only text using the rgb(r, g, b) CSS format (without an alpha channel) will
show the correct color in LibreOffice writer.

Steps to Reproduce:
1. Copy this HTML markup inside a file:

<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <title>Color test</title>
  </head>
  <body>
    <p style="color: rgb(255, 0, 0)">1) This text is pasted with color</p>
    <p style="color: rgb(255 0 0 / 50%)">2) This text is also pasted with
color, but the text pasted has a color which ignores the alpha channel</p>
    <p style="color: rgba(255, 0, 0, 0.3)">3) This text is pasted without
color</p>
  </body>
</html>

2. Open the created HTML file with a web browser
3. Copy the three lines of text into the clipboard
4. Paste the clipboard into LibreOffice Writer

Actual Results:
Pasting line 1) (which uses the rgb(r, g, b) format) into LibreOffice Writer
will show the right color.

Pasting line 2) (which used the rgb(r g b / a) format) into LibreOffice Writer
will show a wrong color (in this case, rgb(r, g, b) without the alpha channel).

Pasting line 3) into LibreOffice Writer will not show any color.

Expected Results:
All three lines should show the correct color.


Reproducible: Always


User Profile Reset: No

Additional Info:
Please note that an alpha channel is not needed to show rgba text. The
algorithm in https://marcodiiga.github.io/rgba-to-rgb-conversion can be used to
turn a RGBA color into RGB.

So, from my example,

rgba(255, 0, 0, 0.3)

can be rendered as:

rgb(255,179,179)

by setting white as the background color.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to