How to use the @bentley/imodeljs-common.ColorDef.from function in @bentley/imodeljs-common

To help you get started, we’ve selected a few @bentley/imodeljs-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / display-test-app / src / frontend / VersionComparison.ts View on Github external
private initOverrides(): FeatureSymbology.Overrides {
    const ovrs = new FeatureSymbology.Overrides(this.viewport);
    ovrs.neverDrawn.clear();
    ovrs.alwaysDrawn.clear();
    ovrs.setAlwaysDrawnSet(this.changedElems.deleted, true, false); // really "only-drawn" - only draw our deleted elements - unless their subcategory is turned off.

    const red = ColorDef.from(0xff, 0, 0, changedTransparency);
    ovrs.setDefaultOverrides(FeatureSymbology.Appearance.fromRgba(red));

    return ovrs;
  }
github imodeljs / imodeljs / core / frontend / src / EmphasizeElements.ts View on Github external
public createOverrideKey(color: ColorDef, override: FeatureOverrideType): number | undefined {
    const colorValues = color.colors;
    switch (override) {
      case FeatureOverrideType.ColorAndAlpha:
        return 255 === colorValues.t ? undefined : color.tbgr; // Hiding elements should be done using neverDrawn, not transparency...
      case FeatureOverrideType.ColorOnly:
        return ColorDef.from(colorValues.r, colorValues.g, colorValues.b, 255).tbgr;
      case FeatureOverrideType.AlphaOnly:
        return -(colorValues.t / 255);
    }
  }
github imodeljs / imodeljs / core / frontend / src / tile / DgnTileIO.ts View on Github external
protected colorDefFromMaterialJson(json: any): ColorDef | undefined {
      return undefined !== json ? ColorDef.from(json[0] * 255 + 0.5, json[1] * 255 + 0.5, json[2] * 255 + 0.5) : undefined;
    }
github imodeljs / imodeljs / core / frontend / src / tile / IModelTileIO.ts View on Github external
protected colorDefFromMaterialJson(json: any): ColorDef | undefined {
      return undefined !== json ? ColorDef.from(json[0] * 255 + 0.5, json[1] * 255 + 0.5, json[2] * 255 + 0.5) : undefined;
    }