Project API Docs

Configuration and theming

Global API configuration

The API has some global configuration options that can only be set at load time. If using the createApi function, these options can be passed to that function when it is called:

// force use of "." as the decimal point,
// even in locales where it would usually be ","
const micd = await createApi(API_KEY, { radixPoint: "." });

If loading the API from a <script> tag, global configuration options can be set in the initial micd object before loading the API:

<script>
micd = {
    key: API_KEY,
    // force use of "." as the decimal point,
    // even in locales where it would usually be ","
    config: { radixPoint: "." },
    onReady: callWhenMicdHasLoaded
};
</script>

Once the API has initialized, the micd.config property will contain a frozen copy of the actual options used by the API, including defaults for any missing or bad values. You can use this to check the actual value of an option at runtime, but changes are ignored and will not affect the configuration. (Some options that can be set as global configuration options can also be changed in other ways; the config property will reflect the global default that was set for these options on initialization.)

Editor, view, and shell instance options

Beyond global configuration options, [[Shell]s, Views, and Editors accept additional options at construction time or through methods. For example, editors can be restricted to a single line or made read only. Views can have custom context menus and keyboard bindings. Shells can customize or replace their command palettes. (If the standard Shell design is not suitable, it can also be completely replaced with a custom design.)

Branding and theming

The editor's default colours, style, interface font and more can be controlled by modifying the theme. This can be set as a global configuration option using the config.theme property, or modified dynamically at any time:

micd.ui.changeTheme({ sBaseTheme: "dark" });

Tip: A design tool in the sample code playground helps you design new themes interactively.


Back to contents

This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.