Skip to main content

Some functions to handle color management on the Drevo Tyrfing V2

Project description

Some important notes

Thanks to @Zer0xFF, this new release improves and speeds up individual key coloring.

The pypi version is not updated as frequently as this repo. So, for latest release, consider git clone.

An example usage is provided in the examples directory. It uses colour package to allow human color names instead of hex triplets!

Installation

  1. Copy the 99-drevo-tyrfing.rules in the /etc/udev/rules.d/ directory to grant user with permissions for to send/write informations to the keyboard. Restart or # udevadm trigger.

  2. pip3 install dtv2

Requirements

dtv2 needs hidapi library: pip3 install hidapi

Change colors

Python module to manage key color assignments on the Drevo Tyrfing v2 keyboard.

import dtv2

my_kbd = dtv2.dtv2()
# mem_effect: the more you type the more color change
my_kbd.mem_effect((0, 0, 0xff), color2=(0xff, 0, 0), brightness=100)
# radar: rays turn around central key (direction: 0 or 1)
my_kbd.radar((0, 0, 0xff), color2=(0xff, 0, 0), brightness=100, speed=100, direction=0)
# static: simple static color or if rainbow=True alternate rainbow colors
my_kbd.static((0, 0, 0xff), brightness=100, speed=100, rainbow=False)
# breath: breath effect
my_kbd.breath((0, 0, 0xff), brightness=100, speed=100)
# stream: stream effect (direction = 'n' or 's' or 'e' or 'w')
my_kbd.stream((0, 0, 0xff), color2=(0xff, 0, 0), brightness=100, speed=100, direction='e', rainbow=False)
# category: change color of a whole category ('letters', 'digits', 'arrows', 'function', 'mod', 'edition')
my_kbd.category('arrows', (0xff, 0, 0))
# key: simple key color change
my_kbd.key('esc', (0xff, 0, 0))

For the moment rainbow in static mode can be tricky and affect other effects.

Using simple key or category modes enter personal mode so exit all others. It can be boring to affect each key of the keyboard to the same color so there's this special method in personal mode to change all the keyboard color (and then you can change categories colors and finally some individual keys): kbd

my_kbd.kbd((0xff, 0, 0))
my_kbd.category('letters', (0, 0, 0xff))
my_kbd.key('space', (0, 0, 0xff))

Recap

If you need a monocolor keyboard : static

If you want some effects : radar, static (with rainbow) breath or stream

If you want to personalize categories or some keys : kbd, category or key.

key identifiers and command prefix

First steps with a prefix from:

https://github.com/dennisblokland/DrevoTyrfing

Then: I used wireshark to find other prefixes.

USB hid tables (for missing french key codes)

colors

Color tuples can be given in decimals, of course.

And now?

  1. Fix bugs

  2. Add functionalities

  3. Add a utility script handling color names (with colour package maybe)

  4. ...

License

CC-BY-NC-SA

Thanks

Flozz

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dtv2-0.4.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

dtv2-0.4-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page