Terminal Themes

This section is about the Themes of the Terminal. The themes specify how the Terminals should look like.

There are a set of built-in Themes which includes a Default Theme.

getTerminalsTheme

Given a themeId, returns the complete theme associated with that Id.

Copy
getTerminalsTheme(state: Object, {themeId: String}): Object);
  • state Object

    Required. The global state of the application.

  • themeId String

    Required. The ID of the theme that we want to retrieve.

Returns

Object

The complete theme.

Example
Copy
const state = storeHelper.getState();
const themeId = 'theme-1';
const getTerminalsTheme = selectorsHelper.make('getTerminalsTheme');
const theme = getTerminalsTheme(state, { themeId });

getTerminalThemeId

Given a terminalId, returns the themeId associated to it.

Copy
getTerminalThemeId(state: Object, { terminalId: String }): String;
  • state Object

    Required. The global state of the application.

  • terminalId String

    Required. The ID from the terminal of which we want to know the theme.

Returns

String

ID of the theme that is applied to the terminal.

Example
Copy
const state = storeHelper.getState();
const terminalId = 'terminal-1';
const getTerminalThemeId = selectorsHelper.make('getTerminalThemeId');
const themeId = getTerminalThemeId(state, { terminalId });

getTerminalsThemesIds

Returns an array with all the themes' IDs.

Copy
getTerminalsThemesIds(state: Object): [String];
  • state Object

    Required. The global state of the application.

Returns

String

Array with all the themes' IDs.

Example
Copy
const state = storeHelper.getState();
const getTerminalsThemesIds = selectorsHelper.make('getTerminalsThemesIds');
const themesIds = getTerminalsThemesIds(state);

replaceTerminalThemeId

Changes the themeId from a terminal, changing it's theme.

Note: Dispatches an action with the type @orion/terminals-helper/REPLACE_TERMINAL_THEME_ID which can be handled.
Copy
dispatchersHelper.dispatch('replaceTerminalThemeId', {
  terminalId: String,
  themeId: String,
});
  • terminalId String

    Required. The terminal ID from the terminal that we want to change.

  • themeID String

    Required. The ID of the new theme.

Example
Copy
const terminalId = 'terminal-1';
const themeId = 'theme-1';

dispatchersHelper.dispatch('replaceTerminalThemeId', { terminalId, themeId });

createTerminalsTheme

Makes a new terminal theme if it does not exist yet. If it already exists, it does nothing.

Note: Dispatches an action with the type @orion/terminals-helper/CREATE_TERMINALS_THEME which can be handled.
Copy
dispatchersHelper.dispatch('createTerminalsTheme', { theme: { id: String } });
  • theme Object

    Required. The theme to be created.

    • id String

      Required. The ID of the theme to be created.

Example
Copy
const theme = {
  id: 'theme-1',
  name: 'Test Theme',
  version: '1.0.0',

  selection: {
    background: 'black',
    color: 'red',
    opacity: '0.5',
  },
};

dispatchersHelper.dispatch('createTerminalsTheme', { theme });