Skip to main content

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lightning_time-0.0.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file lightning-time-0.0.3.tar.gz.

File metadata

  • Download URL: lightning-time-0.0.3.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.0

File hashes

Hashes for lightning-time-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c261624b4250e29d1912e7281e6ab53e7490605c62a7fbdaee5ed152e08040dc
MD5 eb28f106f3ae22d946cd3a65cc84d7a0
BLAKE2b-256 dddaededf6908f65916923c6d997cdb180cd12af8457ac80afd65e19ae399d01

See more details on using hashes here.

File details

Details for the file lightning_time-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for lightning_time-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f69f2241fd2c1178f5d17aef00f49b1c05f8c7c0ee43477af311db2412278288
MD5 4b7b38d232f922b819b50434c8c68031
BLAKE2b-256 a93278970532642f23dceb3cf5622cc8e0105f86a4e6eef5a15586a425495dec

See more details on using hashes here.

Supported by

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