Skip to content

Inconsistency of font and draw module when handling hex color #2542

Open
@yunline

Description

@yunline
import pygame

pygame.init()

font = pygame.font.Font(None, 60)

sf = pygame.display.set_mode((640,480))

sf.fill("black")

COLOR_HEX = 0x00ff00ff
COLOR_DEC = (0, 255, 0, 255)


font_sf1 = font.render("test", True, COLOR_HEX)
sf.blit(font_sf1, (10,10))
pygame.draw.rect(sf, COLOR_HEX , (100,10,50,50))
pygame.draw.circle(sf, COLOR_HEX, (200,35), 30)

font_sf2 = font.render("test", True, COLOR_DEC)
sf.blit(font_sf2, (10,100))
pygame.draw.rect(sf, COLOR_DEC , (100,100,50,50))
pygame.draw.circle(sf, COLOR_DEC, (200,125), 30)

pygame.display.flip()

while 1:
    pygame.event.get()

Result:

图片

Expected:

图片

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot working as intended

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions