Commit Graph

12 Commits

Author SHA1 Message Date
Jon Grace-Cox
800c53f2f0 Update default num padding chars
This commit updates the number of padding characters to zero.  Many issues have been
raised around producing more compact badges, so it feels like the most common usage would be
with this option defaulted to zero.
2019-06-22 01:19:32 -04:00
Jon Grace-Cox
d1afe9eb4f Update badge widths
Switch to using get_text_width(' ') to get padding width.
This results in a more compact badge as the font_width that was used before
was the guesstimated font width that was too large.
2019-06-22 01:18:31 -04:00
Jon Grace-Cox
3d24ecba0f Use different SVG mask ids for each generated badge
Within a single Python session anybadge will use different SVG mask IDs.
This is an attempt to fix the issue where SVG files displayed in the same
HTML will re-use the same mask, and therefore appear with the same dimensions.

Uses a singleton on the class to maintain a sequence of mask ids.

Includes unittests to ensure new ID is used for each badge.
2019-06-01 23:49:13 -04:00
Jon Grace-Cox
4bdb6dcdab Add repr and str dunder functions
* Add __repr__ function that prints the object representation.
* Add __str__ function that prints the Badge SVG text.

Also:
* Add constructor args to the Badge class docstring.
* Change the way defaults are used in the Badge constuctor.  Instead of
  setting values, use None and set arguments to the default values inside
  the constructor.
* Fix unittests that don't use overwrite=True.
2019-06-01 23:15:13 -04:00
Jon Grace-Cox
71fb2551f6 Comment out _get_character_percentage_dict function 2019-06-01 03:38:41 -04:00
Jon Grace-Cox
1532cc247e Add more accurate width calculations for truetype fonts
* Use a better estimation technique to guess text widths.
* Add unittests for validating badge widths for various size badges.
* Add return types to function docstrings.
* Update relevant doctests.
2019-06-01 03:38:34 -04:00
Jon Grace-Cox
1850a95806 Fix green color, and default badge color. 2018-03-26 07:44:51 -04:00
Jon Grace-Cox
2925295a0a Add ability to choose text color (#6) 2017-09-27 21:34:29 -04:00
Jon Grace-Cox
43b42bc2d8 Removed brightgreen color (#7) 2017-09-27 20:39:41 -04:00
Jon Grace-Cox
fe45ac8e2a Changed version number. 2017-09-11 21:25:25 -04:00
Jon Grace-Cox
62bf16c154 Added version info, and Python3 support. 2017-09-11 18:13:40 -04:00
Jon Grace-Cox
420aadd934 Added first version of anybadge module. 2017-09-11 17:12:39 -04:00