Skip to content

[BUG] All colors are mapped wrong on Windows when styling #146

@Abelkrijgtalles

Description

@Abelkrijgtalles

Describe the bug
All colors are mapped wrong on Windows when styling. This isn't just RGB being mapped wrong.

To Reproduce
Steps to reproduce the behavior:

  1. Be on Windows 11 23H2.
  2. Create a window, and a text with a color styling.
  3. Run the program.

Expected behavior
The actual color according to the documentation.

Screenshots
image
All 16-colors styled with their color. Generated with:

import pytermgui as ptg

colors = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'black']
window = ptg.Window()

for color in colors:
    window.__add__("[" + color + " inverse] " + color)

with ptg.WindowManager() as manager:
    manager.layout.add_slot("Body")
    manager.add(
        window
    )

System information
CMD font: JetBrains Mono NFM with a size of 16.
PTG version: 7.7.1

Output Get-ComputerInfo WindowsBuildLabEx : 22621.1.amd64fre.ni_release.220506-1250 WindowsCurrentVersion : 6.3 WindowsEditionId : Professional WindowsInstallationType : Client WindowsInstallDateFromRegistry : 26-11-2023 11:57:03 WindowsProductId : 00330-50000-00000-AAOEM WindowsProductName : Windows 10 Pro WindowsRegisteredOrganization : WindowsRegisteredOwner : Windows-gebruiker WindowsSystemRoot : C:\Windows WindowsVersion : 2009 OSDisplayVersion : 23H2 BiosCharacteristics : {7, 11, 12, 15...} BiosBIOSVersion : {ALASKA - 1072009, FC, American Megatrends - 50011} BiosBuildNumber : BiosCaption : FC BiosCodeSet : BiosCurrentLanguage : en|US|iso8859-1 BiosDescription : FC BiosEmbeddedControllerMajorVersion : 255 BiosEmbeddedControllerMinorVersion : 255 BiosFirmwareType : Uefi BiosIdentificationCode : BiosInstallableLanguages : 15 BiosInstallDate : BiosLanguageEdition : BiosListOfLanguages : {en|US|iso8859-1, zh|TW|unicode, zh|CN|unicode, ru|RU|iso8859 -5...} BiosManufacturer : American Megatrends International, LLC. BiosName : FC BiosOtherTargetOS : BiosPrimaryBIOS : True BiosReleaseDate : 8-6-2023 02:00:00 BiosSeralNumber : Default string BiosSMBIOSBIOSVersion : FC BiosSMBIOSMajorVersion : 3 BiosSMBIOSMinorVersion : 3 BiosSMBIOSPresent : True BiosSoftwareElementState : Running BiosStatus : OK BiosSystemBiosMajorVersion : 5 BiosSystemBiosMinorVersion : 17 BiosTargetOperatingSystem : 0 BiosVersion : ALASKA - 1072009 CsAdminPasswordStatus : Unknown CsAutomaticManagedPagefile : True CsAutomaticResetBootOption : True CsAutomaticResetCapability : True CsBootOptionOnLimit : CsBootOptionOnWatchDog : CsBootROMSupported : True CsBootStatus : {0, 0, 0, 0...} CsBootupState : Normal boot CsCaption : DIKKE-BALLEN CsChassisBootupState : Safe CsChassisSKUNumber : Default string CsCurrentTimeZone : 120 CsDaylightInEffect : True CsDescription : AT/AT COMPATIBLE CsDNSHostName : Dikke-Ballen CsDomain : WORKGROUP CsDomainRole : StandaloneWorkstation CsEnableDaylightSavingsTime : True CsFrontPanelResetStatus : Unknown CsHypervisorPresent : True CsInfraredSupported : False CsInitialLoadInfo : CsInstallDate : CsKeyboardPasswordStatus : Unknown CsLastLoadInfo : CsManufacturer : Gigabyte Technology Co., Ltd. CsModel : B550M AORUS ELITE CsName : DIKKE-BALLEN CsNetworkAdapters : {Ethernet, Bluetooth-netwerkverbinding, Wi-Fi, Ethernet 2...} CsNetworkServerModeEnabled : True CsNumberOfLogicalProcessors : 12 CsNumberOfProcessors : 1 CsProcessors : {AMD Ryzen 5 5600X 6-Core Processor } CsOEMStringArray : {Default string} CsPartOfDomain : False CsPauseAfterReset : -1 CsPCSystemType : Desktop CsPCSystemTypeEx : Desktop CsPowerManagementCapabilities : CsPowerManagementSupported : CsPowerOnPasswordStatus : Unknown CsPowerState : Unknown CsPowerSupplyState : Safe CsPrimaryOwnerContact : CsPrimaryOwnerName : Windows-gebruiker CsResetCapability : Other CsResetCount : -1 CsResetLimit : -1 CsRoles : {LM_Workstation, LM_Server, NT} CsStatus : OK CsSupportContactDescription : CsSystemFamily : B550 MB CsSystemSKUNumber : Default string CsSystemType : x64-based PC CsThermalState : Safe CsTotalPhysicalMemory : 17099730944 CsPhyicallyInstalledMemory : 16777216 CsUserName : DIKKE-BALLEN\Abel CsWakeUpType : PowerSwitch CsWorkgroup : WORKGROUP OsName : Microsoft Windows 11 Pro OsType : WINNT OsOperatingSystemSKU : 48 OsVersion : 10.0.22631 OsCSDVersion : OsBuildNumber : 22631 OsHotFixes : {KB5037591, KB5027397, KB5033055, KB5033204...} OsBootDevice : \Device\HarddiskVolume1 OsSystemDevice : \Device\HarddiskVolume3 OsSystemDirectory : C:\Windows\system32 OsSystemDrive : C: OsWindowsDirectory : C:\Windows OsCountryCode : 31 OsCurrentTimeZone : 120 OsLocaleID : 0413 OsLocale : nl-NL OsLocalDateTime : 5-5-2024 00:39:16 OsLastBootUpTime : 3-5-2024 19:07:59 OsUptime : 1.05:31:17.2941031 OsBuildType : Multiprocessor Free OsCodeSet : 1252 OsDataExecutionPreventionAvailable : True OsDataExecutionPrevention32BitApplications : True OsDataExecutionPreventionDrivers : True OsDataExecutionPreventionSupportPolicy : OptIn OsDebug : False OsDistributed : False OsEncryptionLevel : 256 OsForegroundApplicationBoost : Maximum OsTotalVisibleMemorySize : 16698956 OsFreePhysicalMemory : 3907476 OsTotalVirtualMemorySize : 36621900 OsFreeVirtualMemory : 15307680 OsInUseVirtualMemory : 21314220 OsTotalSwapSpaceSize : OsSizeStoredInPagingFiles : 19922944 OsFreeSpaceInPagingFiles : 18967344 OsPagingFiles : {C:\pagefile.sys} OsHardwareAbstractionLayer : 10.0.22621.2506 OsInstallDate : 26-11-2023 12:57:03 OsManufacturer : Microsoft Corporation OsMaxNumberOfProcesses : 4294967295 OsMaxProcessMemorySize : 137438953344 OsMuiLanguages : {nl-NL} OsNumberOfLicensedUsers : 0 OsNumberOfProcesses : 275 OsNumberOfUsers : 2 OsOrganization : OsArchitecture : 64 bits OsLanguage : nl-NL OsProductSuites : {TerminalServicesSingleSession} OsOtherTypeDescription : OsPAEEnabled : OsPortableOperatingSystem : False OsPrimary : True OsProductType : WorkStation OsRegisteredUser : Windows-gebruiker OsSerialNumber : 00330-50000-00000-AAOEM OsServicePackMajorVersion : 0 OsServicePackMinorVersion : 0 OsStatus : OK OsSuites : {TerminalServices, TerminalServicesSingleSession} OsServerLevel : KeyboardLayout : 00020409 TimeZone : (UTC+01:00) Amsterdam, Berlijn, Bern, Rome, Stockholm, Wenen LogonServer : \\DIKKE-BALLEN PowerPlatformRole : Desktop HyperVisorPresent : True HyperVRequirementDataExecutionPreventionAvailable : HyperVRequirementSecondLevelAddressTranslation : HyperVRequirementVirtualizationFirmwareEnabled : HyperVRequirementVMMonitorModeExtensions : DeviceGuardSmartStatus : Off DeviceGuardRequiredSecurityProperties : {0} DeviceGuardAvailableSecurityProperties : {BaseVirtualizationSupport, DMAProtection, SecureMemoryOverwr ite, 5...} DeviceGuardSecurityServicesConfigured : {0} DeviceGuardSecurityServicesRunning : {0} DeviceGuardCodeIntegrityPolicyEnforcementStatus : EnforcementMode DeviceGuardUserModeCodeIntegrityPolicyEnforcementStatus : Off

Possible cause
No idea.

Possible solution
Not yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions