MCPcopy Create free account
hub / github.com/Effect-TS/effect / renderToggle

Function renderToggle

packages/effect/src/cli/Prompt.ts:4043–4061  ·  view source on GitHub ↗
(
  value: boolean,
  options: ToggleOptionsReq,
  theme: Theme,
  submitted: boolean = false
)

Source from the content-addressed store, hash-verified

4041})
4042
4043const renderToggle = (
4044 value: boolean,
4045 options: ToggleOptionsReq,
4046 theme: Theme,
4047 submitted: boolean = false
4048) => {
4049 const separator = annotateSymbol(theme, theme.toggleSeparator, theme.mutedColor)
4050 const selectedAnnotation = Ansi.combine(
4051 Ansi.underlined,
4052 submitted ? theme.submittedColor : theme.primaryColor
4053 )
4054 const inactive = value
4055 ? options.inactive
4056 : Ansi.annotate(theme.colors, options.inactive, selectedAnnotation)
4057 const active = value
4058 ? Ansi.annotate(theme.colors, options.active, selectedAnnotation)
4059 : options.active
4060 return active + " " + separateSymbol(separator, inactive)
4061}
4062
4063const renderToggleNextFrame = Effect.fnUntraced(function*(state: ToggleState, options: ToggleOptionsReq) {
4064 const figures = yield* getTheme(options)

Callers 1

Prompt.tsFile · 0.85

Calls 4

annotateSymbolFunction · 0.85
separateSymbolFunction · 0.85
combineMethod · 0.65
annotateMethod · 0.65

Tested by

no test coverage detected