From abdbc1da2e341913d0f4fb75e08df65a0b713387 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Wed, 15 Jun 2022 01:40:03 -0500 Subject: [PATCH] feat: switch default font to support nerd fonts --- LICENSE.txt | 2 +- README.md | 2 +- yartsu/_export_format.py | 46 ++++++++++++++++++++++++++++++++++++++++ yartsu/cli.py | 8 ++++++- 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 yartsu/_export_format.py diff --git a/LICENSE.txt b/LICENSE.txt index a6f4388..50f627d 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/README.md b/README.md index 482b8f8..bfa1139 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ See [here](https://github.com/daylinmorgan/yartsu/blob/main/docs/themes.md) a pr ## TODO - [ ] add unit tests -- [ ] add support for nerd-fonts +- [x] add support for nerd-fonts - [ ] add optional shadow - [ ] add more themes diff --git a/yartsu/_export_format.py b/yartsu/_export_format.py new file mode 100644 index 0000000..5f4fced --- /dev/null +++ b/yartsu/_export_format.py @@ -0,0 +1,46 @@ +CONSOLE_SVG_FORMAT = """\ + + + + + + + + {lines} + + {chrome} + + {backgrounds} + + {matrix} + + + +""" diff --git a/yartsu/cli.py b/yartsu/cli.py index 18eefaf..7e02df3 100644 --- a/yartsu/cli.py +++ b/yartsu/cli.py @@ -7,6 +7,7 @@ from pathlib import Path from rich.console import Console from rich.text import Text +from ._export_format import CONSOLE_SVG_FORMAT from ._run_cmd import run_cmd from ._version import __version__ from .argparse import ArgumentParser @@ -117,6 +118,11 @@ def main() -> None: console.print(parsed_input) - console.save_svg(args.output, title=title, theme=THEMES[args.theme]) + console.save_svg( + args.output, + title=title, + theme=THEMES[args.theme], + code_format=CONSOLE_SVG_FORMAT, + ) term.print(f"\nSaved to {args.output}.")