diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py
index b4d49c594dbcf8a2c299fa2ad6e82da4828f8579..7b350f73b5a2376347e05a0ec52477abeef20856 100644
--- a/lib/spack/docs/conf.py
+++ b/lib/spack/docs/conf.py
@@ -48,9 +48,7 @@
 
 # Set an environment variable so that colify will print output like it would to
 # a terminal.
-os.environ['COLIFY_TTY'] = 'true'
-os.environ['COLUMNS']    = '80'
-os.environ['LINES']      = '25'
+os.environ['COLIFY_SIZE'] = '25x80'
 
 # Enable todo items
 todo_include_todos = True
diff --git a/lib/spack/llnl/util/tty/colify.py b/lib/spack/llnl/util/tty/colify.py
index 6b2909990caa160f3d1981253f1a293133d3e6ed..66c52c39687aead1ed1e8175f25b500bcf5ad957 100644
--- a/lib/spack/llnl/util/tty/colify.py
+++ b/lib/spack/llnl/util/tty/colify.py
@@ -169,6 +169,15 @@ def colify(elts, **options):
     if not elts:
         return (0, ())
 
+    # environment size is of the form "<rows>x<cols>"
+    env_size = os.environ.get('COLIFY_SIZE')
+    if env_size:
+        try:
+            r, c = env_size.split('x')
+            console_rows, console_cols = int(r), int(c)
+            tty = True
+        except: pass
+
     # Use only one column if not a tty.
     if not tty:
         if tty is False or not output.isatty():