A simple package to utilize Lightning Time in python
Project description
Lightning Time
TODO: add description here
Learn more about how Lightning Time works & play with it hands-on: here
Installation
pip3 install lightning-time
from LightningTime.Lightning import Lightning, Timestring
Usage
Colors
from LightningTime.Lightning import Lightning, Timestring
# Create a Lightning object
lt = Lightning(Timestring("a~b~c|d"))
By default, the Lightning
colors are set to the following:
bolt: (dynamic value), 161, 0
zap: 50, (dynamic value), 214
spark: 246, 133, (dynamic value)
You can change these colors by passing in color arguments to the Lightning
object:
lt = Lightning(Timestring("a~b~c|d"), bolt_color=(g, b), zap_color=(r, b), spark_color=(r, g))
r, g and b are integers between 0 and 255, inclusive.
For example, to change the color of a bolt
, use the following:
lt = Lightning(Timestring("a~b~c|d"), bolt_color=(155, 35))
You can set the static colors of a Lightning
object with the set_static_colors
method:
lt.set_static_colors((g, b), (r, b), (r, g))
Conversions
from datetime import datetime
#convert from datetime to Lightning time
Lightning.to_lightning(datetime.now()) #e~3~3|8
#convert from Lightning time to a time st
Lightning.from_lightning(Lightning.to_lightning(datetime.now()), withseconds=True) # 21:18:06
Color String
from datetime import datetime
Lightning.to_lightning(datetime.now()).color_strings() # ('#e3a100', '#3238d6', '#f68582')
Print without charges
from datetime import datetime
Lightning.to_lightning(datetime.now()).strip_charges()
# e~3~a
Accessing values
lt = Lightning(Timestring("a~b~c|d"))
lt.timestring.bolts # a
lt.timestring.zaps # b
lt.timestring.sparks # c
lt.timestring.charges # d
Contributing
This project is still under development, feel free to contribute by opening a pull request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lightning-time-0.0.3.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for lightning_time-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f69f2241fd2c1178f5d17aef00f49b1c05f8c7c0ee43477af311db2412278288 |
|
MD5 | 4b7b38d232f922b819b50434c8c68031 |
|
BLAKE2b-256 | a93278970532642f23dceb3cf5622cc8e0105f86a4e6eef5a15586a425495dec |