def test_color_from_rgb_bytes(): verify_color(Color.from_rgb_bytes(1, 1, 1).rgb_bytes, (1, 1, 1)) verify_color(Color.from_rgb_bytes(255, 255, 255), (1.0, 1.0, 1.0)) verify_color(Color.from_rgb_bytes(r=255, g=255, b=255), (1.0, 1.0, 1.0))
hat.screen represents the 8 x 8 grid of LEDs on the HAT. hat.stick represents the miniature joystick at the bottom right of the HAT. hat.environ represents the environmental (pressure, humidity and temperature) sensors on the HAT. hat.imu represents the sensors of the Internal Measurement Unit (IMU) on the HAT. """ stick = hat.stick in_flash = False cPieces = {False: 'rnbqkp', True: 'PRNBQK'} brightness = 0.2 # Dictionary to map pieces to Sense HAT colours ColMap = { #red 'p': Color.from_rgb_bytes(64, 16, 0), 'n': Color.from_rgb_bytes(112, 32, 0), 'b': Color.from_rgb_bytes(160, 48, 0), 'r': Color.from_rgb_bytes(192, 64, 0), 'q': Color.from_rgb_bytes(224, 96, 0), 'k': Color.from_rgb_bytes(255, 128, 0), #blue 'P': Color.from_rgb_bytes(0, 16, 64), 'N': Color.from_rgb_bytes(0, 33, 112), 'B': Color.from_rgb_bytes(0, 48, 160), 'R': Color.from_rgb_bytes(0, 64, 192), 'Q': Color.from_rgb_bytes(0, 96, 224), 'K': Color.from_rgb_bytes(0, 128, 255) } # Screen position of the cursor