Skip to content

Text Customization

Text Parameters#

Paremeters - as mentioned in Manim Community Documentation - are:

  • Constructor : - Text()

  • Parameters :

  • fill_opacity :

    • float (ex: 1.0)
    • Optional
  • stroke_width :

    • float (ex: 2.5)
    • Optional
  • color :

    • color (ex: BLUE)
    • Optional
    • Default : (WHITE)
  • font_size :

    • float (ex: 30)
    • Optional
  • line_spacing :

    • float (ex: 3.0)
    • Optional
  • font :

    • string (ex: "Consolas")
    • Optional
  • slant :

    • string (ex: ``)
    • Optional
  • weight :

    • string (ex: ``)
    • Optional
  • gradient :

    • tuple (ex: (YELLOW, RED))
    • Optional
  • tab_width :

    • integer (ex: 2)
    • Optional
  • height :

    • integer (ex: 4)
    • Optional
  • width :

    • integer (ex: 2)
    • Optional
  • should_center :

    • bool (ex: True)
    • Optional
  • unpack_groups :

    • bool (ex: False)
    • Optional
  • disable_ligatures :

    • bool (ex: False)
    • Optional
  • t2c :

    • Dict ({key: value}) (ex: "word": BLUE)
    • key = string, value = string
  • t2f :

    • Dict ({key: value}) (ex: "word": Ink Free)
    • key = string, value = string
  • t2g :

    • Dict ({key: value}) (ex: "word": (RED, YELLOW))
    • key = string, value = tuple
  • t2s :

    • Dict ({key: value}) (ex: "word": ITALIC)
    • key = string, value = string
  • t2w :

    • Dict ({key: value}) (ex: "word": BOLD)
    • key = string, value = string

Change (Font / Color / Slant / Weight)#

from manimlib import *

class TextExample(Scene):
  def construct(self):

      text = Text("""Manim Text Example""", font="Consolas", font_size=50, t2c={"Text": BLUE},
                  t2f={"Text": "Ink Free"})

      self.play(Write(text))
      self.wait(2)
      self.play(FadeOut(text))

      text2 = Text("""Font / Color / Slant / Weight""", font="Consolas", font_size=50,
                   t2c={"Color": RED}, t2f={"Font": "Ink Free"}, t2s={"Slant": ITALIC}, t2w={"Weight": BOLD},)

      self.play(Write(text2))
      self.wait(3)
      self.play(FadeOut(text2))
from manim import *

class TextExample(Scene):
  def construct(self):

      text = Text("""Manim Text Example""", font="Consolas", font_size=50, t2c={"Text": BLUE},
                  t2f={"Text": "Ink Free"})

      self.play(Write(text))
      self.wait(2)
      self.play(FadeOut(text))

      text2 = Text("""Font / Color / Slant / Weight""", font="Consolas", font_size=50,
                   t2c={"Color": RED}, t2f={"Font": "Ink Free"}, t2s={"Slant": ITALIC}, t2w={"Weight": BOLD},)

      self.play(Write(text2))
      self.wait(3)
      self.play(FadeOut(text2))

Gradient Color#

from manimlib import *

class GradientText(Scene):
  def construct(self):

      text2 = Text('Gradient Text', gradient=(RED, YELLOW), font="Constantia").scale(3)
      self.play(Write(text2))
      self.wait(2)
from manim import *

class GradientText(Scene):
  def construct(self):

      text2 = Text('Gradient Text', gradient=(RED, YELLOW), font="Constantia").scale(3)
      self.play(Write(text2))
      self.wait(2)

Writing Arabic Text#

from manimlib import *

class ArabicText(Scene):
  def construct(self):

      arb = Text("صباح الخير", font="Traditional Arabic").scale(3)

      self.play(Write(arb))
from manim import *

class ArabicText(Scene):
  def construct(self):

      arb = Text("صباح الخير", font="Traditional Arabic").scale(3)

      self.play(Write(arb))

Setting a Title#

from manimlib import *

class TitleText(Scene):
  def construct(self):

      title = Title('Title Text')
      self.play(Write(title))
      self.wait(2)
from manim import *

class TitleText(Scene):
  def construct(self):

      title = Title('Title Text')
      self.play(Write(title))
      self.wait(2)

Bulleted List#

from manimlib import *

class BulletedListExample(Scene):
  def construct(self):

      blist = BulletedList("Item 1", "Item 2", "Item 3").scale(3)
      blist.set_color_by_tex("Item 1", RED)
      blist.set_color_by_tex("Item 2", YELLOW)
      blist.set_color_by_tex("Item 3", BLUE)
      self.play(Write(blist))
      self.wait(3)
from manim import *

class BulletedListExample(Scene):
  def construct(self):

      blist = BulletedList("Item 1", "Item 2", "Item 3", height=4, width=3)
      blist.set_color_by_tex("Item 1", RED)
      blist.set_color_by_tex("Item 2", YELLOW)
      blist.set_color_by_tex("Item 3", BLUE)
      self.play(Write(blist))
      self.wait(3)
Back to top