[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: Add __repr__ for QColor?
From:       Adam Gausmann <AdamG () esdemc ! com>
Date:       2023-04-05 17:49:50
Message-ID: CABu+Ghy+Zxk6roegSTa5G-U16p2DeUWa2yHSz-=mJUEmUbk_Lw () mail ! gmail ! com
[Download RAW message or body]

On Tue, Apr 4, 2023 at 8:18 PM RoadrunnerWMC <roadrunnerwmc@gmail.com> wrote:
> 
> The float constructor lets you specify more accurate values, but since the \
> components aren't stored as floats, the rounding makes it kind of gross: 
> > > > QtGui.QColor.fromRgbF(0.5, 0.5, 0.501)
> PyQt6.QtGui.QColor.fromRgbF(0.5000076293945312, 0.5000076293945312, \
> 0.5009994506835938)> 

Using a formatting specifier like `{:.6f}` to truncate it to 5 or 6
digits will make that look nicer, since that's the amount of precision
provided by the 16-bit storage.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic