Repository: pixijs/pixijs
File: src/utils/logging/deprecation.ts (TypeScript)

Code before:
     * @default false
     * @standard
     */
    noColor: boolean;
}

/** @internal */
export type DeprecationFn = ((version: string, message: string, ignoreDepth?: number) => void) & DeprecationOptions;

const deprecationState: DeprecationOptions = {
    quiet: false,
    noColor: true
};

/**
 * Helper for warning developers about deprecated features & settings.
 * A stack track for warnings is given; useful for tracking-down where
 * deprecated methods/properties/classes are being used within the code.
 *
 * Deprecation messages can be configured globally:
 * ```ts
 * // Suppress all deprecation messages
 * deprecation.quiet = true;
 *
 * // Put plain text to console instead of colorful messages
 * deprecation.colorful = false;
 * ```
 * @category utils
 * @ignore
 * @function deprecation
 * @param {string} version - The version where the feature became deprecated
 * @param {string} message - Message should include what is deprecated, where, and the new solution
 * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack
 *        this is mostly to ignore internal deprecation calls.
 */
export const deprecation: DeprecationFn = ((version: string, message: string, ignoreDepth: number = 3) =>
{
    // Suppress if is in quiet mode and ignore duplicate
    if (deprecationState.quiet || warnings.has(message)) return;

    /* eslint-disable no-console */
    let stack = new Error().stack;

    const deprecationMessage = `${message}\nDeprecated since v${version}`;
    const useGroup = typeof console.groupCollapsed === 'function' && deprecationState.noColor;

    // Handle IE < 10 and Safari < 6
    if (typeof stack === 'undefined')
    {
        console.warn('PixiJS Deprecation Warning: ', deprecationMessage);
    }

Review comment (suggestion):
```suggestion
 * deprecation.noColor = true;
```

Code after:
     * @default false
     * @standard
     */
    noColor: boolean;
}

/** @internal */
export type DeprecationFn = ((version: string, message: string, ignoreDepth?: number) => void) & DeprecationOptions;

const deprecationState: DeprecationOptions = {
    quiet: false,
    noColor: false
};

/**
 * Helper for warning developers about deprecated features & settings.
 * A stack track for warnings is given; useful for tracking-down where
 * deprecated methods/properties/classes are being used within the code.
 *
 * Deprecation messages can be configured globally:
 * ```ts
 * // Suppress all deprecation messages
 * deprecation.quiet = true;
 *
 * // Put plain text to console instead of colorful messages
 * deprecation.noColor = true;
 * ```
 * @category utils
 * @ignore
 * @function deprecation
 * @param {string} version - The version where the feature became deprecated
 * @param {string} message - Message should include what is deprecated, where, and the new solution
 * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack
 *        this is mostly to ignore internal deprecation calls.
 */
export const deprecation: DeprecationFn = ((version: string, message: string, ignoreDepth: number = 3) =>
{
    // Suppress if is in quiet mode and ignore duplicate
    if (deprecationState.quiet || warnings.has(message)) return;

    /* eslint-disable no-console */
    let stack = new Error().stack;

    const deprecationMessage = `${message}\nDeprecated since v${version}`;
    const useGroup = typeof console.groupCollapsed === 'function' && !deprecationState.noColor;

    // Handle IE < 10 and Safari < 6
    if (typeof stack === 'undefined')
    {
        console.warn('PixiJS Deprecation Warning: ', deprecationMessage);
    }