-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0817efa
commit decf9b8
Showing
10 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package icons | ||
|
||
import ( | ||
"encoding/base64" | ||
"errors" | ||
|
||
"github.com/Alex222222222222/AppOcr/files" | ||
) | ||
|
||
type IconType int64 | ||
|
||
const ( | ||
IconTypeApp IconType = iota | ||
IconTypeCaptureScreenShot | ||
IconTypeScanQRCode | ||
IconTypeOCR | ||
IconTypeQuit | ||
IconTypeChangeTheme | ||
IconTypeScanBarCode | ||
IconTYpeScanDataMatrix | ||
) | ||
|
||
func GetIcon(iconType IconType, darkMode bool) ([]byte, error) { | ||
iconRaw, err := GetIconRaw(iconType, darkMode) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return base64.StdEncoding.DecodeString(iconRaw) | ||
} | ||
|
||
func GetIconRaw(iconType IconType, darkMode bool) (string, error) { | ||
switch iconType { | ||
case IconTypeApp: | ||
if darkMode { | ||
return files.IconDark, nil | ||
} else { | ||
return files.Icon, nil | ||
} | ||
case IconTypeCaptureScreenShot: | ||
if darkMode { | ||
return files.ScreenshotIconDark, nil | ||
} else { | ||
return files.ScreenshotIcon, nil | ||
} | ||
case IconTypeScanQRCode: | ||
if darkMode { | ||
return files.ScanQRCodeIconDark, nil | ||
} else { | ||
return files.ScanQRCodeIcon, nil | ||
} | ||
case IconTypeOCR: | ||
if darkMode { | ||
return files.ScanOcrIconDark, nil | ||
} else { | ||
return files.ScanOcrIcon, nil | ||
} | ||
case IconTypeQuit: | ||
if darkMode { | ||
return files.QuitIconDark, nil | ||
} else { | ||
return files.QuitIcon, nil | ||
} | ||
/* | ||
case IconTypeChangeTheme: | ||
if darkMode { | ||
return files.ChangeThemeIconDark, nil | ||
} else { | ||
return files.ChangeThemeIcon, nil | ||
} | ||
*/ | ||
case IconTypeScanBarCode: | ||
if darkMode { | ||
return files.ScanBarCodeIconDark, nil | ||
} else { | ||
return files.ScanBarCodeIcon, nil | ||
} | ||
case IconTYpeScanDataMatrix: | ||
if darkMode { | ||
return files.ScanDataMatrixIconDark, nil | ||
} else { | ||
return files.ScanDataMatrixIcon, nil | ||
} | ||
default: | ||
return "", errors.New("invalid icon type") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters