MCPcopy Index your code
hub / github.com/cmang/durdraw

github.com/cmang/durdraw @0.29.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.29.0 ↗ · + Follow
488 symbols 1,542 edges 30 files 149 documented · 31%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Durdraw

              __                __
            _|  |__ __ _____ __|  |_____ _____ __ __ __
           / _  |  |  |   __|  _  |   __|  _  |  |  |  |\
          /_____|_____|__|__|_____|__|___\____|________| | 
          \_____________________________________________\|  v 0.29.0

durdraw-0 28-demo

Overview

Durdraw is an ASCII, Unicode and ANSI art editor for UNIX-like systems (Linux, macOS, etc). It runs in modern Utf-8 terminals and supports frame-based animation, custom themes, 256 and 16 color modes, terminal mouse input, DOS ANSI art viewing, CP437 and Unicode mixing and conversion, HTML output, mIRC color output, and other interesting features.

Durdraw is heavily inspired by classic ANSI editing software for MS-DOS and Windows, such as TheDraw, Aciddraw and Pablodraw, but with a modern Unix twist.


Requirements

  • Python 3 (3.10+ recommended)
  • Linux, macOS, or other Unix-like System

Optional Requirements

  1. ansilove

    For PNG and animated GIF export, please install ansilove (https://ansilove.org/) and make sure it is is in your path.
    PNG and GIF export only works in 16-color mode for now, and only with CP437 compatible characters.

  2. neofetch

    For durfetch support, please install neofetch and place it in your path.

Installation

You can install durdraw via several methods:

After installing, you should be able to run durdraw. Press esc-h for help, or try durdraw --help for command-line options.

If you just want to run it without installing, see Running Without Installing. You can also install via the included Dockerfile.

Via OS Repositories

Packaging status

Via Source Repository

  1. Download and extract, or use git to download:

    shell git clone https://github.com/cmang/durdraw.git cd durdraw

  2. Install or upgrade using pip:

    shell python3 -m pip install --upgrade .

  3. Optionally, install some themes and a sample configuration file for your local user into ~/.durdraw/:

    shell ./installconf.sh This will place durdraw.ini into ~/.durdraw/ and the themes into ~/.durdraw/themes/.

Via pip

Alternatively, you can install the pip package pip directly (Please note that this installation method does not include everything, i.e. the example dur files under examples/, or the entrypoint scripts in the section below)

# install `master` branch version:
python3 -m pip install 'git+https://github.com/cmang/durdraw'

# install specific version:
python3 -m pip install 'git+https://github.com/cmang/durdraw@0.28.0'

# install `dev` branch version:
python3 -m pip install 'git+https://github.com/cmang/durdraw@dev'

Running Without Installing

You can run Durdraw with:

./start-durdraw

To look at some included example animations:

./start-durdraw -p examples/*.dur

Gallery

Tutorials

Watch the Tutorial Part 1 Watch another video

Screenshots

durdraw-xmas-example dopetrans3
durdraw-screenshot durdraw-linux-unicode-ansi
cm-doge bsd-color-new

Usage

Command Line

You can play a .dur file or series of .dur (or .ANS or .ASC) files with:

durdraw -p filename.dur
durdraw -p file1.dur file2.dur file3.dur ...

Or view a downloaded ANSI artpack with:

durdraw -p *.DIZ *.ASC *.ANS

Other command-line options:

usage: durdraw [-h] [-p PLAY [PLAY ...]] [-d DELAYEXIT] [-x TIMES] [--256color | --16color] [-b] [-W WIDTH] [-H HEIGHT] [-m]
                     [--wrap WRAP] [--nomouse] [--cursor CURSOR] [--notheme] [--theme THEME] [--cp437] [--export-ansi] [-u UNDOSIZE]
                     [--fetch] [-V]
                     [filename]

positional arguments:
  filename              .dur or ascii file to load

options:
  -h, --help            show this help message and exit
  -p PLAY [PLAY ...], --play PLAY [PLAY ...]
                        Just play .dur, .ANS or .ASC file or files, then exit
  -d DELAYEXIT, --delayexit DELAYEXIT
                        Wait X seconds after playback before exiting (requires -p)
  -x TIMES, --times TIMES
                        Play X number of times (requires -p)
  --256color            Try 256 color mode
  --16color             Try 16 color mode
  -b, --blackbg         Use a black background color instead of terminal default
  -W WIDTH, --width WIDTH
                        Set canvas width
  -H HEIGHT, --height HEIGHT
                        Set canvas height
  -m, --max             Maximum canvas size for terminal (overrides -W and -H)
  --wrap WRAP           Number of columns to wrap lines at when loading ASCII and ANSI files (default 80)
  --nomouse             Disable mouse support
  --cursor CURSOR       Cursor mode (block, underscore, or pipe)
  --notheme             Disable theme support (use default theme)
  --theme THEME         Load a custom theme file
  --cp437               Display extended characters on the screen using Code Page 437 (IBM-PC/MS-DOS) encoding instead of Utf-8.
                        (Requires CP437 capable terminal and font) (beta)
  --export-ansi         Export loaded art to an .ansi file and exit
  -u UNDOSIZE, --undosize UNDOSIZE
                        Set the number of undo history states - default is 100. More requires more RAM, less saves RAM.
  --fetch               Replace fetch strings with Neofetch output
  -V, --version         Show version number and exit

Interactive Usage/Editing

  • Use the arrow keys (or mouse) and other keys to edit, much like a text editor.
  • You can click highlighted areas of the screen.
  • You can use the "Esc" (or "Meta") key to access keyboard shortcuts and commands:
   ____________.       _________   __________ _________  _____          _______
.-\\___     /  |______/  _     /.-\\___     //  _     /_/  _  \_.____.  \     /
|    |/    /   |    /    /    /:|    |/    /    /    /Y    Y    Y    |  /    /
|    /    /|   |   /    _   _/ ||    /    /:   _   _/ :    _    |    /\/    /
|        /:|   :    :   Y      |:        /:|   Y      |    Y    |          /:H7
|____     |_________|___|      |_____     |____|      |    |____|____/\_____|
.-- `-----' ----------- `------': - `-----' -- `------'----' -----------------.
|                                                                             |
`-----------------------------------------------------------------------------'

  .. Art Editing .....................   .. Animation .......................
  : F1-F10 - insert character        :   : esc-k - next frame               :
  : esc-1 to esc-0 - same as F1-F10  :   : esc-j - previous frame           :
  : esc-space - insert draw char     :   : esc-p - start/stop payback       :
  : esc-c/tab - color picker         :   : esc-n - clone frame              :
  : esc-left - next fg color         :   : esc-N - append empty frame       :
  : esc-right - prev fg color        :   : esc-d - delete frame             :
  : esc-up - change color up         :   : esc-D - set frame delay          :
  : esc-down - change color down     :   : esc-+/esc-- - faster/slower      :
  : esc-' - insert line              :   : esc-R - set playback/edit range  :
  : esc-; - delete line              :   : esc-g - go to frame #            :
  : esc-. - insert column            :   : esc-M - move frame               :
  : esc-, - delete column            :   : esc-{ - shift frames left        :
  : esc-] - next character group     :   : esc-} - shift frames right       :
  : esc-[ - previous character group :   :..................................:
  : esc-S - change character set     :
  : esc-L - replace color            :   .. UI/Misc .........................
  : esc-y - eyedrop (pick up color)  :   : esc-m - main menu                :
  : esc-P - pick up character        :   : esc-a - animation menu           :
  : esc-l - color character          :   : esc-t - mouse tools              :
  : shift-arrows - select for copy   :   : esc-z - undo                     :
  : esc-K - mark selection           :   : esc-r - redo                     :
  : esc-v - paste                    :   : esc-V - view mode                :
  :..................................:   : esc-i - file/canvas info         :
                                         : esc-I - character inspector      :
  .. File Operations .................   : esc-F - search/find string       :
  : esc-C - new/clear canvas         :   : ctrl-l - redraw screen           :
  : esc-o - open                     :   : esc-h - help                     :
  : esc-s - save                     :   : esc-q - quit                     :
  :..................................:   :..................................:

  .. Canvas Size .....................
  : esc-" - insert line              :
  : esc-: - delete line              :
  : esc-> - insert column            :
  : esc-< - delete column            :
  :..................................:

                                                          esc-j  esc-k
                                                          Prev   Next  Canvas
esc-f  esc-g   esc--                                      Frame  Frame   Size
esc-m  Go to   esc-+      esc-D   esc-R      esc-t        | esc-p|         |
 Main  Frame   Speed      Frame   Play/Edit  Mouse  First | Play/| Last    |
 Menu  Number     |       Delay   Range      Tools  Frame | Pause| Frame   |
  |    |          |        |       |          |        |  |  |   |  |      |
[Menu] F: 1/7   <FPS>: 8   D: 0.00 R: 1/8   [Move]     |< << |> >> >| [80x24]

 tab
 esc-c                     esc-S
 Pick        esc-[ esc-]   Charset set   F1-F10         esc-[ esc-]
 Foreground    Character   or Unicode    Insert Special  Prev/Next    Cursor
 Color             Group   Block         Characters     Char Group  Position
  |                  |        |             |                     \       |
FG:██              (1/21)  [Dur..] <F1░F2▒F3▓F4█F5▀F6▄F7▌F8▐F9■F10·>  (12,10)

 ANIMATION:

    Use the Animation Menu [Anim] or keyboard commands to insert (esc-n),
    delete (esc-d), move (esc-M) and edit frames. Use esc-k and esc-j to
    flip to the next and previous frames. The "Play" button (|> or esc-p)
    starts or stops playback.

    When the animation is playing, all changes made effect all frames
    within the current playback/edit Range (R: or esc-R). Change playback
    speed (<FPS> or Frames Per Second) with esc-+ (or esc-=) and esc--.
    F: shows the current frame number, and you can go to a specific frame
    with esc-g.

 BRUSHES:

    To make a brush, use shift-arrow or esc-K to make a selection, then
    press b. To use the brush, click the Mouse Tools menu (esc-t) and select
    Paint (P). You can now use the mouse to paint with your custom brush.

Configuration

You can create a custom startup file where you can set a theme and other options.

If you did not already do so during installation, you can install a sample configuration (See step 3 underInstallation via Source Repository)

Here is an example durdraw.ini file, showing the available options:

; Durdraw 0.28.0 Configuration File

[Main]

; color-mode sets the color mode to start in. Available options: 16, 256
;color-mode: 16

; disable-mouse disables the mouse.
;disable-mouse: True

; max-canvas automatically sets the canvas size to the terminal window size at startup.
;max-canvas: True

; Cursor mode requests a cursor type from the terminal. Available options: block, underscore, pipe
;cursor-mode: underscore

; When scroll-colors is enabled, using the mouse wheel in the canvas changes the
; foreground color instead of moving the cursor.
;scroll-colors: True

[Theme]
theme-16: ~/.durdraw/themes/mutedchill-16.dtheme.ini
theme-256: ~/.durdraw/themes/mutedform-256.dtheme.ini

[Logging]
; filepath is the path to the log file. Default is ./durdraw.log
;filepath: ./durdraw.log

; level sets the logging level. Available options: DEBUG, INFO, WARNING, ERROR, CRITICAL. Default is WARNING
;level: WARNING

; local-tz indicates if the computer's local timezone should be used when logging instead of UTC
;local-tz: False

The option 'theme-16' sets the path to t

Core symbols most depended-on inside this repo

addstr
called by 143
durdraw/durdraw_ui_curses.py
notify
called by 102
durdraw/durdraw_ui_curses.py
curses_addstr
called by 64
durdraw/durdraw_ui_widgets_curses.py
insertChar
called by 56
durdraw/durdraw_ui_curses.py
add_item
called by 52
durdraw/durdraw_ui_widgets.py
refresh
called by 52
durdraw/durdraw_ui_curses.py
push
called by 51
durdraw/durdraw_undo.py
hardRefresh
called by 49
durdraw/durdraw_ui_curses.py

Shape

Method 409
Function 46
Class 33

Languages

Python100%

Modules by API surface

durdraw/durdraw_ui_curses.py195 symbols
durdraw/durdraw_ui_widgets.py72 symbols
durdraw/durdraw_ui_widgets_curses.py52 symbols
durdraw/durdraw_movie.py38 symbols
durdraw/durdraw_appstate.py27 symbols
durdraw/durdraw_color_curses.py17 symbols
test/durdraw/test_log.py11 symbols
durdraw/durdraw_file.py9 symbols
durdraw/log.py8 symbols
durdraw/durdraw_undo.py8 symbols
durdraw/durdraw_sixteencolors.py8 symbols
durdraw/durfetch.py7 symbols

For agents

$ claude mcp add durdraw \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page