Skip to content

CaPusto/Material-Design-Calculator

Repository files navigation

Material Design Calculator

A simple cross-platform desktop calculator with Material Design dark/light theme, built with Fyne and expr-lang/expr.

On Rocky Linux - dark theme On Windows 11 - light theme
qr qr

Features

  • Basic arithmetic: +, -, ×, ÷
  • Unary operations: 1/x, , √x, %, ±
  • Parentheses and expression chaining
  • Keyboard input support
  • History panel with expression recovery
  • Clipboard copy/paste
  • Memory: MC, MR, M+, M-
  • π constant
  • Division-by-zero protection (AST-level)
  • i18n: English / Русский (auto-detected, override with -locale=ru)
  • Dark & light themes (follows system)

Build

Dependencies

Linux:

# Debian/Ubuntu
sudo apt install gcc pkg-config libgl1-mesa-dev libegl1-mesa-dev \
  libxrandr-dev libxcursor-dev libxinerama-dev libxi-dev \
  libxkbcommon-dev libwayland-dev

# Rocky/RHEL
sudo dnf install gcc pkgconfig mesa-libGL-devel mesa-libEGL-devel \
  libXrandr-devel libXcursor-devel libXinerama-devel libXi-devel \
  libxkbcommon-devel wayland-devel

Windows (cross-compile from Linux):

sudo dnf install mingw64-gcc
make build-windows

Windows (native-compile from Windows):

install mingw64-gcc
go mod tidy
go build -ldflags="-s -w -H=windowsgui" -o calculator.exe .

macOS: Xcode Command Line Tools.

Build & run

make build     # Linux
make build-windows  # Windows .exe
make run       # build + launch

Or manually:

go build -ldflags="-s -w" -o calculator .
./calculator

Usage

  • Type expressions directly or use the on-screen buttons
  • Press = or Enter to evaluate
  • Backspace to delete last character, Escape to clear
  • Click history entries to restore an expression
  • % works as percentage of the preceding value (e.g. 100+10%110)
  • Press = repeatedly to repeat the last operation

Project structure

├── main.go       # GUI and calculator logic
├── theme.go      # Material Design theme (dark/light)
├── i18n.go       # Localization (EN/RU)
├── validator.go  # Zero-division AST checker
├── Makefile      # Build automation

License

MIT

About

A simple cross-platform arithmetic calculator in Material Design style

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages