TerminalBrightness class final
Whether the terminal's colors are dark or light, for the widgets below
it (TerminalBrightness.of); Theme.adaptive picks its theme by it.
An app on a terminal puts it at the top: the brightness of the
terminal's background (TerminalInfo.brightness) at first, that of each
ColorSchemeReport after.
One of its own below the binding's says what the widgets under it see, as a test or a preview of the light theme does:
const TerminalBrightness(
brightness: Brightness.light,
child: Theme.adaptive(child: Text('in ThemeData.light')),
)
- Inheritance
-
- Object
- Widget
- ProxyWidget
- InheritedWidget
- TerminalBrightness
Constructors
-
TerminalBrightness({required Brightness brightness, required Widget child, bool known = true, int? background, int? foreground, Map<
int, int> palette = const {}, Key? key}) -
Gives
child's subtreebrightness, which the terminal said unlessknownis false.const
Properties
- background → int?
-
The terminal's default background as it told it (OSC 11),
0xRRGGBB; null where it did not.final - brightness → Brightness
-
Whether the terminal's background is dark or light.
final
- child → Widget
-
The widget below this one, which it shows as it is.
finalinherited
- foreground → int?
-
The terminal's default text color as it told it (OSC 10),
0xRRGGBB; null where it did not.final - hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Tells this widget apart from its siblings; see Key.
finalinherited
- known → bool
-
Whether the terminal said what its background is: false where it
answered no query of it, brightness then a guess, its environment's
(
COLORFGBG) or dark. A guess picks the greys of the terminal's own colors (ThemeData.terminal), never twk's themes: a stale one would put a light theme's dark text on a dark terminal.final -
palette
→ Map<
int, int> -
The entries of the terminal's 16 colors it told (OSC 4), RGB
(
0xRRGGBB) by index; empty where it told none.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → InheritedElement -
Inflates this widget into a new element for the tree.
override
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Adds what describes this widget in its element's description
(Element.describe) to
properties, those not worth showing (a default) left out; an override calls this first. A render object widget adds only what its render object does not show. Only Element.describe calls it: a frame never does.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateShouldNotify(
covariant TerminalBrightness oldWidget) → bool -
Whether the elements that depend on this widget are to be rebuilt now
that it replaced
oldWidget.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
backgroundOf(
BuildContext context) → int? -
The terminal's default background at
context, as the nearest TerminalBrightness has it; null without one or where the terminal did not tell it.contextdepends on it. -
foregroundOf(
BuildContext context) → int? -
The terminal's default text color at
context, as the nearest TerminalBrightness has it; null without one or where the terminal did not tell it.contextdepends on it. -
isKnown(
BuildContext context) → bool -
Whether the brightness at
contextis the terminal's own word: the nearest TerminalBrightness's known, false without one.contextdepends on it. -
of(
BuildContext context) → Brightness -
The brightness at
context: that of the nearest TerminalBrightness, dark without one.contextdepends on it. -
paletteOf(
BuildContext context) → Map< int, int> -
The palette the terminal told at
context, as the nearest TerminalBrightness has it; empty without one.contextdepends on it.