set_modsem_colors: Define or disable the color theme used by 'modsem'

View source: R/colorize_output.R

set_modsem_colorsR Documentation

Define or disable the color theme used by modsem

Description

All arguments are optional; omitted ones fall back to the defaults below. Pass active = FALSE to turn highlighting off (and reset the palette).

Usage

set_modsem_colors(
  positive = "green3",
  negative = positive,
  true = "green3",
  false = "red",
  nan = "purple",
  na = "purple",
  inf = "purple",
  string = "cyan",
  active = TRUE
)

Arguments

positive

color of positive numbers.

negative

color of negative numbers.

true

color of TRUE.

false

color of FALSE.

nan

color of NaN.

na

color of NA.

inf

color of -Inf and Inf.

string

color of quoted strings.

active

Should color-theme be activated/deactived?

Value

TRUE if colors are active afterwards, otherwise FALSE.

Examples

set_modsem_colors(positive = "red3",
                  negative = "red3",
                  true = "darkgreen",
                  false = "red3",
                  na = "purple",
                  string = "darkgreen")

m1 <- "
# Outer Model
  X =~ x1 + x2 + x3
  Z =~ z1 + z2 + z3
  Y =~ y1 + y2 + y3
# Inner Model
  Y ~ X + Z + X:Z
"

est <- modsem(m1, data = oneInt)
colorize_output(summary(est))
colorize_output(est) # same as colorize_output(print(est))
colorize_output(modsem_inspect(est, what = "coef"))

## Not run: 
colorize_output(split = TRUE, {
  # Get live (uncolored) output
  # And print colored output at the end of execution

  est_lms <- modsem(m1, data = oneInt, method = "lms")
  summary(est_lms)
})

colorize_output(modsem_inspect(est_lms))

## End(Not run)

modsem documentation built on Aug. 27, 2025, 9:08 a.m.