A highly configurable, maintainable calculator built with Electron, featuring modern design with Geist fonts and TailwindCSS-inspired styling.
- Basic arithmetic operations (addition, subtraction, multiplication, division)
- Percentage calculation
- Clear and delete functionality
- Keyboard support
- Clean, modern UI
- Highly Configurable: Easy-to-modify configuration files for themes, buttons, and app behavior
- Modern Design: Clean UI with Geist Sans and Geist Mono fonts
- Multiple Themes: Default, Dark, and Minimal themes with easy theme switching
- Responsive: Adapts to different screen sizes
- Accessible: WCAG compliant with proper focus management
- Maintainable: Modular architecture with clear separation of concerns
- Error Handling: Comprehensive error handling and logging
- Cross-Platform: Works on Windows, macOS, and Linux
- Node.js (v16 or higher)
- npm (comes with Node.js)
-
Clone the repository:
git clone https://github.com/pilot2254/calculator.git cd calculator
-
Install dependencies:
npm install
-
Start the application:
npm start
Run in development mode with additional logging:
npm run dev
Edit `config/theme.config.js` to modify existing themes or add new ones:
export const THEMES = {
myCustomTheme: {
name: 'My Custom Theme',
colors: {
background: '#your-color',
// ... other colors
}
}
}
Modify `config/buttons.config.js` to change button layout or add new functions:
export const BUTTON_LAYOUT = [
[
{ type: 'special', action: 'clear', label: 'AC' },
// ... other buttons
]
]
Adjust `config/app.config.js` for window size, features, and behavior:
export const APP_CONFIG = {
window: {
width: 320,
height: 500,
// ... other settings
}
}
Key | Action |
---|---|
`0-9` | Number input |
`.` | Decimal point |
`+`, `-`, `*`, `/` | Operations |
`Enter` or `=` | Calculate |
`Backspace` | Delete last digit |
`Escape` or `Delete` | Clear |
`%` | Percentage |
`Cmd/Ctrl+T` | Toggle always on top |
`Cmd/Ctrl+D` | Toggle theme |
`Cmd/Ctrl+Q` | Quit |
src/
├── main.js # Main Electron process
├── renderer.js # Renderer entry point
├── calculator/
│ ├── calculator-engine.js # Core calculation logic
│ └── ui-controller.js # UI management
└── utils/
└── logger.js # Logging utility
config/
├── app.config.js # Main app configuration
├── theme.config.js # Theme definitions
└── buttons.config.js # Button layout & keyboard mappings
To build the application for your platform:
npm run build
Build for all platforms:
npm run build:all
The modular architecture makes it easy to add:
- Scientific calculator mode
- Calculation history
- Memory functions (MC, MR, M+, M-)
- Unit conversions
- Custom themes editor
- Plugin system
- Cloud sync
- Fork the repository
- Create a feature branch: `git checkout -b feature/amazing-feature`
- Commit your changes: `git commit -m 'Add amazing feature'`
- Push to the branch: `git push origin feature/amazing-feature`
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Electron - Framework for building cross-platform desktop apps
- Geist Font - Beautiful typography by Vercel
- TailwindCSS - Inspiration for utility-first styling approach
- Geist Font - Beautiful typography by Vercel