Code Monkey home page Code Monkey logo

calculator_gl's Introduction

UI Implementations

  1. This calculator can detect the dark or light mode of your browser and change the theme/background accordingly upon window load.
  2. A random color theme will be generated for buttons on every page load using an RNG function. The generated theme will always be visually appealing, thanks to implemented logic for good HSL color generation. This feature is inspired by Google's Material You theming on Android 12.
  3. The calculator is designed to be responsive on all screens.

UX Implementations

  1. JavaScript float precision errors are rectified in most cases to ensure accurate calculations.
  2. The maximum display limit for the calculator's result is set to 9. Any numbers beyond this limit (0 - 999999999, including decimal values) will display a Range Error.
  3. If the result has a decimal and falls between 0 and 999999999 (including decimal values), a maximum of 9 characters will be displayed for the entire answer.
  4. Error handling is implemented for zero division.
  5. An additional "." button is provided to calculate decimal values, and JavaScript float precision errors are addressed in most cases.
  6. Appropriate logic is implemented to prevent entering multiple decimals for a number.

Further Improvements

  1. The randomization of themes could be wrapped in a function and assigned to a button, allowing users to change the theme dynamically instead of randomizing it on page load. The theme values could also be stored in local storage and retrieved and applied after window loads.
  2. Key mapping to the numpad can be implemented by adding an event listener on the window's keydown event and writing appropriate logic for the pressed key.
  3. Animation could be added to enhance the user experience when entering digits on the display.
  4. Every edge case has been taken care of, but if you encounter any bugs, please let us know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.