Code: Select all
h := Format("{:#08X} {:#08x} {:#06x} {:#08x} {:#06x} 0x{:06x} ", 0, 1, 1, 0xffffff, 0xffffff, 0)
i := Format("{:04} {:04} {:04} ", 4, +4, -4)
MsgBox %h%`n%i%
; 00000000 0x000001 0x0001 0xffffff 0xffffff 0x000000
; 0004 0004 00-4
For any positive number other than zero it works as expected.
When dealing with colors it's a bit annoying to work around emulating a deprecated style.
The doc reads "Unsigned hexadecimal integer; uses "abcdef" or "ABCDEF" depending on the case of x. The 0x prefix is not included unless the # flag is used, as in {:#x}. For hexadecimal formatting consistent with SetFormat, use 0x{:x} or similar." Well, you have to add 2 to the width for the prefix but it makes sense as width is width.
Just out of curiosity I've checked negative integers and it doesn't handle them well either.