Skip to content

MLR126: Literal opacity outside [0, 1] or negative stroke width

qual reports MLR126 when a literal style value is out of range on a knowledge-resolved call:

  • fill_opacity, stroke_opacity, or opacity keyword of a mobject constructor outside [0.0, 1.0];
  • the opacity argument of set_opacity(...), set_fill(..., opacity), or set_stroke(opacity=...) outside [0.0, 1.0];
  • a negative literal stroke_width keyword or set_stroke(width=...).

  • Default severity: error

  • Minimum confidence: high
  • Implementation phase: 1
  • Fix: none

Opacity is an alpha channel: values outside [0, 1] are not meaningful and render as clamped or corrupted colors; a negative stroke width is never a valid pen size. Calls on unknown receivers and non-literal values never fire.

Wrong:

Square(fill_opacity=1.5)
square.set_stroke(width=-3)

Right:

Square(fill_opacity=0.5)
square.set_stroke(width=3)
square.set_opacity(level)   # non-literal: not reported