Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Aug 26, 2024
1 parent 6e4fee0 commit d174146
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/eez-studio-ui/_stylesheets/project-editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -3243,7 +3243,7 @@

li {
margin: 5px;
border: 2px solid #eee;
border: 1px solid @borderColor;
padding: 5px;
background-color: @backgroundColor;
cursor: pointer;
Expand Down
11 changes: 9 additions & 2 deletions packages/project-editor/features/font/GlyphSelectFieldType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
setColor
} from "project-editor/flow/editor/eez-gui-draw";
import { formatEncoding } from "project-editor/features/font/utils";
import { settingsController } from "home/settings";

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -396,8 +397,14 @@ export const Glyph = observer(

const encoding = data.fontExtract.allEncodings[index];

setColor("black");
setBackColor("white");
if (settingsController.isDarkTheme) {
setColor("white");
setBackColor("black");
} else {
setColor("black");
setBackColor("white");
}

const canvas = drawGlyph2(encoding, data.fontExtract);

return (
Expand Down
12 changes: 10 additions & 2 deletions packages/project-editor/features/font/Glyphs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { SearchInput } from "eez-studio-ui/search-input";

import { Font, Glyph } from "project-editor/features/font/font";
import { ProjectContext } from "project-editor/project/context";
import { settingsController } from "home/settings";

export const Glyphs = observer(
class Glyphs
Expand Down Expand Up @@ -236,8 +237,15 @@ export const GlyphComponent = observer(
canvas.width = (glyph.glyphBitmap && glyph.glyphBitmap.width) || 1;
canvas.height = glyph.font.height || 1;
let ctx = canvas.getContext("2d")!;
setColor("black");
setBackColor("white");

if (settingsController.isDarkTheme) {
setColor("white");
setBackColor("black");
} else {
setColor("black");
setBackColor("white");
}

drawGlyph(ctx, -glyph.x, 0, glyph.encoding, glyph.font);

React.useEffect(() => {
Expand Down
3 changes: 2 additions & 1 deletion packages/project-editor/features/font/font.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import {
import { generalGroup } from "project-editor/ui-components/PropertyGrid/groups";
import type { ProjectEditorFeature } from "project-editor/store/features";
import { getLvglDefaultFontBpp } from "project-editor/lvgl/lvgl-versions";
import { settingsController } from "home/settings";

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -453,7 +454,7 @@ export class Glyph extends EezObject {
if (this.glyphBitmap) {
const project = ProjectEditor.getProject(this);

ctx.fillStyle = "black";
ctx.fillStyle = settingsController.isDarkTheme ? "white" : "black";
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
const pixelValue = getPixel(
Expand Down

0 comments on commit d174146

Please sign in to comment.