Git Product home page Git Product logo

compose-neumorphism's Introduction

Neumorphism using Jetpack Compose

Neumorphism design implementation in jetpack compose.

Maven Central

Featured on Google dev library

What is Neumorphism

  • Neumorphism is a ui design concept which mainly uses shadows to create awesome looking UI.
  • Basic design concept from Neumorphism are Extruded and Pressed/Flat style.
  • Neumorphism design concept allows us to represent a objects like how it appear on real world. (like a extruded volume control nob on a media player app)

About this library

  • This library enables android application to create Neumorphic design using Jetpack Compose

Sample app preview

Dark Light
screen-dark screen-light

Install

You can install compose-neumorphism by adding this to your build.gradle file

dependencies {
  implementation 'io.github.sridhar-sp:neumorphic:0.0.6'
}

Features

  • Draw shadows on widget to bring out the neumorphic design, following neumorphic components are supported.
    • Extruded or Elevated view
    • Pressed View
  • All the above neumorphic component support two corner shape
    • RoundedCorner
    • Oval
  • Simply add a single neu modifier on any compose component to create a neumorphic design

Usage

Refer the sample app provided for more information.

Extruded or Elevated design

Extruded or Elevated button

Dark Light
elevated-button-dark elevated-button-light
    Button(
        modifier = Modifier
            .defaultMinSize(minHeight = 80.dp)
            .fillMaxWidth()
            .padding(defaultWidgetPadding)
            .neu(
                lightShadowColor = AppColors.lightShadow(),
                darkShadowColor = AppColors.darkShadow(),
                shadowElevation = defaultElevation,
                lightSource = LightSource.LEFT_TOP,
                shape = Flat(defaultCornerShape),
            ),
        colors = ButtonDefaults.buttonColors(
            backgroundColor = MaterialTheme.colors.surface
        )
    ) {
        Text(
            text = "Button", style = AppTextStyle.button()
        )
    }

Elevated card view with rounded rectangle shape

Dark Light
elevated-card-dark elevated-card-light
    Card(
        modifier = Modifier
            .size(128.dp)
            .neu(
                lightShadowColor = AppColors.lightShadow(),
                darkShadowColor = AppColors.darkShadow(),
                shadowElevation = defaultElevation,
                lightSource = LightSource.LEFT_TOP,
                shape = Flat(RoundedCorner(24.dp)),
            ),
        elevation = 0.dp,
        shape = RoundedCornerShape(24.dp),
    ){
    	// Add child components here.
    }
    

Pressed design

Pressed button

Dark Light
pressed-button-dark pressed-button-light
    Button(
        modifier = Modifier
            .fillMaxWidth()
            .padding(defaultWidgetPadding)
            .neu(
                lightShadowColor = AppColors.lightShadow(),
                darkShadowColor = AppColors.darkShadow(),
                shadowElevation = defaultElevation,
                lightSource = LightSource.LEFT_TOP,
                shape = Pressed(defaultCornerShape),
            ),
        colors = ButtonDefaults.buttonColors(
            backgroundColor = MaterialTheme.colors.surface,
        ),
        shape = RoundedCornerShape(12.dp),
        elevation = null

    ) {
        Text(text = "Button", style = AppTextStyle.button())
    }

Pressed card view with rounded rectangle shape

Dark Light
pressed-card-dark pressed-card-light
    Card(
        modifier = Modifier
            .size(128.dp)
            .neu(
                lightShadowColor = AppColors.lightShadow(),
                darkShadowColor = AppColors.darkShadow(),
                shadowElevation = defaultElevation,
                lightSource = LightSource.LEFT_TOP,
                shape = Pressed(RoundedCorner(24.dp)),
            ),
        elevation = 0.dp,
        shape = RoundedCornerShape(24.dp),
    ){
    	// Add child components here.
    }

Light source

LEFT_TOP RIGHT_TOP LEFT_BOTTOM RIGHT_BOTTOM
elevated_card_left_top_dark elevated_card_right_top_dark elevated_card_left_bottom_dark elevated_card_right_bottom_dark
elevated_card_left_top_light elevated_card_right_top_light elevated_card_left_bottom_light elevated_card_right_bottom_light

Shapes

Pressed Elevated
shape_pressed_card_dark shape_elevated_card_dark
shape_pressed_card_light shape_elevated_card_light

Sample implementation

Get it on Google Play

Reference

compose-neumorphism's People

Contributors

sridhar-sp avatar b-re-w avatar w2sv avatar

Stargazers

Burden Haze  avatar

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.